Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-04

Tree within library

7 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner
to SteveG: a few questions this time: First, problems using Forms in a library (.so) 1. If using a…
Show quoted text 32 lines
Mattias Gaertner wrote: > On Mon, 28 Apr 2003 00:12:24 +1000 > SteveG wrote: > > >>a few questions this time: >> >>First, problems using Forms in a library (.so) >>1. If using a TTreeView I get an error msg - ERROR: >>[TgtkObject.CreateBitmap] Illegal depth 0, >>as the library initializes, and am unable to focus on any items. >>Works ok on a standard test program - > > > I tried dynamic libs under fpc a few months ago and ran into several > problems. How do you create the libs? > I load / unload my libraries with the following code (sample library as attachment) pStr1:=StrAlloc( 255 ); StrPCopy( pStr1, npFindFile('libLxSystem.so', npAppPath(), 0) ); LxSystem_LibAddr := dlopen( pStr1, 1 ); StrDispose( pStr1 ); pointer( LxSystem_LxCmdIn_1 ) := dlsym( LxSystem_LibAddr, 'LxCmdIn_1' ); if LxSystem_LibAddr Nil then dlclose( LxSystem_LibAddr );

I only got access violations.

Use cmem as heapmanager. Add it as first unit in the library. Then a treeview seems to work.
See attachment.

Show quoted text 10 lines
>>2. If the form is sent behind another, then brought back to the front, >>all TStaticTest objects and TSpeedbuttons have disappeared and the >>screen needs to be re-drawn in code to refresh > > > Normally the gtk sends an expose event in such cases, which results in a > LM_PAINT message. Can you send me an example? > The sample library I have attached will cause the above problem - would you prefer me to supply a working exe/lib example ?

There are also 3 TSpeedButtons in the attached example, which don't have the problem you described. Maybe it's an windowmanager issue.

Mattias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gz00021.gz
Type: application/octet-stream
Size: 2486 bytes
Desc: "examplelib.tgz"
Url : http://localhost/pipermail/lazarus/attachments/20030429/17c9b32f/gz00021.obj

Reply by email

SteveG
to SteveG: a few questions this time: First, problems using Forms in a library (.so) 1. If using a…

Mattias
Your example does works ok, so I have imported your code into a small project to demonstrate my problem. (attached)
when running, you 'should' see that the
speedbuttons/statictext/image/tree all disappear/corrupt when a window is moved over the top of them. Also notice that the tree items can not be selected once the library has opened, but the edit field works ok.

In this example, it seems the library form is fine, but the main app form shows the problem - probably solve one, solve all.

Thanks

Mattias Gaertner wrote 66 lines
On Tue, 29 Apr 2003 10:43:44 +1000 SteveG wrote: >Mattias Gaertner wrote: > >>On Mon, 28 Apr 2003 00:12:24 +1000 >>SteveG wrote: >> >> >> >>>a few questions this time: >>> >>>First, problems using Forms in a library (.so) >>>1. If using a TTreeView I get an error msg - ERROR: >>>[TgtkObject.CreateBitmap] Illegal depth 0, >>>as the library initializes, and am unable to focus on any items. >>>Works ok on a standard test program - >> >> >>I tried dynamic libs under fpc a few months ago and ran into several >>problems. How do you create the libs? >> > >I load / unload my libraries with the following code (sample library as >attachment) > pStr1:=StrAlloc( 255 ); > > StrPCopy( pStr1, npFindFile('libLxSystem.so', npAppPath(), 0) ); > > LxSystem_LibAddr := dlopen( pStr1, 1 ); > StrDispose( >pStr1 ); > > pointer( LxSystem_LxCmdIn_1 ) := dlsym( LxSystem_LibAddr, 'LxCmdIn_1' ); > > >if LxSystem_LibAddr Nil then dlclose( LxSystem_LibAddr ); I only got access violations. Use cmem as heapmanager. Add it as first unit in the library. Then a treeview seems to work. See attachment. >>>2. If the form is sent behind another, then brought back to the front, >>>all TStaticTest objects and TSpeedbuttons have disappeared and the >>>screen needs to be re-drawn in code to refresh >> >> >>Normally the gtk sends an expose event in such cases, which results in a >>LM_PAINT message. Can you send me an example? >> > >The sample library I have attached will cause the above problem - would >you prefer me to supply a working exe/lib example ? There are also 3 TSpeedButtons in the attached example, which don't have the problem you described. Maybe it's an windowmanager issue. Mattias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gz00022.gz
Type: application/octet-stream
Size: 13591 bytes
Desc: "prg2.tgz"
Url : http://localhost/pipermail/lazarus/attachments/20030430/9a4f866f/gz00022.obj

Reply by email

SteveG
to SteveG: a few questions this time: First, problems using Forms in a library (.so) 1. If using a…
Mattias Gaertner wrote 16 lines
On Mon, 28 Apr 2003 00:12:24 +1000 SteveG wrote: >a few questions this time: > >First, problems using Forms in a library (.so) >1. If using a TTreeView I get an error msg - ERROR: >[TgtkObject.CreateBitmap] Illegal depth 0, >as the library initializes, and am unable to focus on any items. >Works ok on a standard test program - I tried dynamic libs under fpc a few months ago and ran into several problems. How do you create the libs?

I load / unload my libraries with the following code (sample library as attachment)

  pStr1:=StrAlloc( 255 );
  StrPCopy( pStr1, npFindFile('libLxSystem.so', npAppPath(), 0) );
  LxSystem_LibAddr := dlopen( pStr1, 1 );
                                                        StrDispose(
pStr1 );
  pointer( LxSystem_LxCmdIn_1 ) := dlsym( LxSystem_LibAddr, 'LxCmdIn_1' );
if LxSystem_LibAddr  Nil then dlclose( LxSystem_LibAddr );
Show quoted text 10 lines
>2. If the form is sent behind another, then brought back to the front, >all TStaticTest objects and TSpeedbuttons have disappeared and the >screen needs to be re-drawn in code to refresh Normally the gtk sends an expose event in such cases, which results in a LM_PAINT message. Can you send me an example?

The sample library I have attached will cause the above problem - would you prefer me to supply a working exe/lib example ?

Show quoted text 48 lines
>3. TSpeedbuttons disappear if the mouse is passed over them (not >clicking) - screen redraw needed to refresh Seems to be related to the above. >These problems on normal programs, and within libraries >1. Images on TImage, and TSpeedbutton (actually any images at all once >the program runs) seem ok when viewing in the IDE, but once program runs >all images are just various blocks of solid color Streaming images to the LFM files is not yet implemented. Maybe we should add a warning message to not load images with form editing. Only load images at runtime. >2. Problems with tab order in any program - not only unable to set >specific ordering, focus seems to disappear after 'last' control (takes >two tabs to re-appear) - my test prog is new form at Laz start, add 4 >TEdits and run - tab problems ?? Tab stops are disabled, because there were some components doing strange things. The current tabbing you see, is the default gtk behaviour. Maybe someone give this a second try. I'm currently busy with the IDE. >All of these seem to be grapic related. Is this a problem only on my >machine ? (RH8 + KDE, latest CVS) No, I don't think so. Mattias _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

-------------- next part --------------
A non-text attachment was scrubbed...
Name: zip00011.zip
Type: application/octet-stream
Size: 2469 bytes
Desc: "Library.zip"
Url : http://localhost/pipermail/lazarus/attachments/20030428/1b7ef971/zip00011.obj

Reply by email

Mattias Gaertner
to SteveG: a few questions this time: First, problems using Forms in a library (.so) 1. If using a…
Show quoted text 7 lines
a few questions this time: First, problems using Forms in a library (.so) 1. If using a TTreeView I get an error msg - ERROR: [TgtkObject.CreateBitmap] Illegal depth 0, as the library initializes, and am unable to focus on any items. Works ok on a standard test program -

I tried dynamic libs under fpc a few months ago and ran into several problems. How do you create the libs?

2. If the form is sent behind another, then brought back to the front, all TStaticTest objects and TSpeedbuttons have disappeared and the screen needs to be re-drawn in code to refresh

Normally the gtk sends an expose event in such cases, which results in a LM_PAINT message. Can you send me an example?

3. TSpeedbuttons disappear if the mouse is passed over them (not clicking) - screen redraw needed to refresh

Seems to be related to the above.

These problems on normal programs, and within libraries 1. Images on TImage, and TSpeedbutton (actually any images at all once the program runs) seem ok when viewing in the IDE, but once program runs all images are just various blocks of solid color

Streaming images to the LFM files is not yet implemented. Maybe we should add a warning message to not load images with form editing. Only load images at runtime.

2. Problems with tab order in any program - not only unable to set specific ordering, focus seems to disappear after 'last' control (takes two tabs to re-appear) - my test prog is new form at Laz start, add 4 TEdits and run - tab problems ??

Tab stops are disabled, because there were some components doing strange things. The current tabbing you see, is the default gtk behaviour. Maybe someone give this a second try. I'm currently busy with the IDE.

All of these seem to be grapic related. Is this a problem only on my machine ? (RH8 + KDE, latest CVS)

No, I don't think so.

Mattias

Reply by email

Mattias Gaertner
to SteveG: a few questions this time: First, problems using Forms in a library (.so) 1. If using a…
Show quoted text 10 lines
Mattias Your example does works ok, so I have imported your code into a small project to demonstrate my problem. (attached) when running, you 'should' see that the speedbuttons/statictext/image/tree all disappear/corrupt when a window is moved over the top of them. Also notice that the tree items can not be selected once the library has opened, but the edit field works ok. In this example, it seems the library form is fine, but the main app form shows the problem - probably solve one, solve all.

You are doubling code.
Both, the lib and your program contain the full LCL code and thus creating two applications. The only thing that is shared, is the gtk lib and that's why the edit fields work.
Either you use the LCL in only one of them (the program or the lib) or you put the LCL, FCL and every shared part into one or more libs. The second solution is of course much more elegant. And if it would work, the lazarus team would have done so. The sad truth is that fpc does not yet fully support dynamic libs (PIC). For simple programs you can use the cmem trick, but for such monsters as the LCL, FCL, ... it is not sufficient. I hope this information is outdated or there is a workaround to get dynamic libs. Maybe someone of the fpc team can give us a hint.

Mattias

Show quoted text 75 lines
Thanks Mattias Gaertner wrote: > On Tue, 29 Apr 2003 10:43:44 +1000 > SteveG wrote: > > >>Mattias Gaertner wrote: >> >>>On Mon, 28 Apr 2003 00:12:24 +1000 >>>SteveG wrote: >>> >>> >>> >>>>a few questions this time: >>>> >>>>First, problems using Forms in a library (.so) >>>>1. If using a TTreeView I get an error msg - ERROR: >>>>[TgtkObject.CreateBitmap] Illegal depth 0, >>>>as the library initializes, and am unable to focus on any items. >>>>Works ok on a standard test program - >>> >>> >>>I tried dynamic libs under fpc a few months ago and ran into several >>>problems. How do you create the libs? >>> >> >>I load / unload my libraries with the following code (sample library as >>attachment) >> pStr1:=StrAlloc( 255 ); >> >> StrPCopy( pStr1, npFindFile('libLxSystem.so', npAppPath(), 0) ); >> >> LxSystem_LibAddr := dlopen( pStr1, 1 ); >> StrDispose( >>pStr1 ); >> >> pointer( LxSystem_LxCmdIn_1 ) := dlsym( LxSystem_LibAddr, 'LxCmdIn_1' >);> >> >>if LxSystem_LibAddr Nil then dlclose( LxSystem_LibAddr ); > > > I only got access violations. > > Use cmem as heapmanager. Add it as first unit in the library. > Then a treeview seems to work. > See attachment. > > > >>>>2. If the form is sent behind another, then brought back to the front, > >>>>all TStaticTest objects and TSpeedbuttons have disappeared and the >>>>screen needs to be re-drawn in code to refresh >>> >>> >>>Normally the gtk sends an expose event in such cases, which results in >a>>LM_PAINT message. Can you send me an example? >>> >> >>The sample library I have attached will cause the above problem - would >>you prefer me to supply a working exe/lib example ? > > > There are also 3 TSpeedButtons in the attached example, which don't have > the problem you described. Maybe it's an windowmanager issue. > > > Mattias

Reply by email

SteveG

a few questions this time:

First, problems using Forms in a library (.so)
1. If using a TTreeView I get an error msg - ERROR: [TgtkObject.CreateBitmap] Illegal depth 0,
as the library initializes, and am unable to focus on any items. Works ok on a standard test program -

2. If the form is sent behind another, then brought back to the front, all TStaticTest objects and TSpeedbuttons have disappeared and the screen needs to be re-drawn in code to refresh

3. TSpeedbuttons disappear if the mouse is passed over them (not clicking) - screen redraw needed to refresh

These problems on normal programs, and within libraries
1. Images on TImage, and TSpeedbutton (actually any images at all once the program runs) seem ok when viewing in the IDE, but once program runs all images are just various blocks of solid color

2. Problems with tab order in any program - not only unable to set specific ordering, focus seems to disappear after 'last' control (takes two tabs to re-appear) - my test prog is new form at Laz start, add 4 TEdits and run - tab problems ??

All of these seem to be grapic related. Is this a problem only on my machine ? (RH8 + KDE, latest CVS)

Appreciate any help with these.

Reply by email

SteveG
to SteveG

Drat - Thanks anyway, I'll have to try something different to fix this.

Mattias Gaertner wrote 121 lines
On Thu, 01 May 2003 01:55:23 +1000 SteveG wrote: >Mattias >Your example does works ok, so I have imported your code into a small >project to demonstrate my problem. (attached) >when running, you 'should' see that the >speedbuttons/statictext/image/tree all disappear/corrupt when a window >is moved over the top of them. Also notice that the tree items can not >be selected once the library has opened, but the edit field works ok. > >In this example, it seems the library form is fine, but the main app >form shows the problem - probably solve one, solve all. You are doubling code. Both, the lib and your program contain the full LCL code and thus creating two applications. The only thing that is shared, is the gtk lib and that's why the edit fields work. Either you use the LCL in only one of them (the program or the lib) or you put the LCL, FCL and every shared part into one or more libs. The second solution is of course much more elegant. And if it would work, the lazarus team would have done so. The sad truth is that fpc does not yet fully support dynamic libs (PIC). For simple programs you can use the cmem trick, but for such monsters as the LCL, FCL, ... it is not sufficient. I hope this information is outdated or there is a workaround to get dynamic libs. Maybe someone of the fpc team can give us a hint. Mattias >Thanks > > >Mattias Gaertner wrote: > >>On Tue, 29 Apr 2003 10:43:44 +1000 >>SteveG wrote: >> >> >> >>>Mattias Gaertner wrote: >>> >>> >>>>On Mon, 28 Apr 2003 00:12:24 +1000 >>>>SteveG wrote: >>>> >>>> >>>> >>>> >>>>>a few questions this time: >>>>> >>>>>First, problems using Forms in a library (.so) >>>>>1. If using a TTreeView I get an error msg - ERROR: >>>>>[TgtkObject.CreateBitmap] Illegal depth 0, >>>>>as the library initializes, and am unable to focus on any items. >>>>>Works ok on a standard test program - >>>> >>>> >>>>I tried dynamic libs under fpc a few months ago and ran into several >>>>problems. How do you create the libs? >>>> >>> >>>I load / unload my libraries with the following code (sample library as >>>attachment) >>> pStr1:=StrAlloc( 255 ); >>> >>> StrPCopy( pStr1, npFindFile('libLxSystem.so', npAppPath(), 0) ); >>> >>> LxSystem_LibAddr := dlopen( pStr1, 1 ); >>> StrDispose( >>>pStr1 ); >>> >>> pointer( LxSystem_LxCmdIn_1 ) := dlsym( LxSystem_LibAddr, 'LxCmdIn_1' >> >>);> >> >>>if LxSystem_LibAddr Nil then dlclose( LxSystem_LibAddr ); >> >> >>I only got access violations. >> >>Use cmem as heapmanager. Add it as first unit in the library. >>Then a treeview seems to work. >>See attachment. >> >> >> >> >>>>>2. If the form is sent behind another, then brought back to the front, >>>> >>>>>all TStaticTest objects and TSpeedbuttons have disappeared and the >>>>>screen needs to be re-drawn in code to refresh >>>> >>>> >>>>Normally the gtk sends an expose event in such cases, which results in >>> >>a>>LM_PAINT message. Can you send me an example? >> >>>The sample library I have attached will cause the above problem - would >>>you prefer me to supply a working exe/lib example ? >> >> >>There are also 3 TSpeedButtons in the attached example, which don't have >>the problem you described. Maybe it's an windowmanager issue. >> >> >>Mattias > > > _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email