[lazarus] Tree within library

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Apr 30 12:24:37 EDT 2003


On Thu, 01 May 2003 01:55:23 +1000
SteveG <steveg at nevets.com.au> 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 <steveg at nevets.com.au> wrote:
> > 
> > 
> >>Mattias Gaertner wrote:
> >>
> >>>On Mon, 28 Apr 2003 00:12:24 +1000
> >>>SteveG <steveg at nevets.com.au> 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
> 
> 
> 






More information about the Lazarus mailing list