[Lazarus] fpGUI

Sven Barth pascaldragon at googlemail.com
Mon Jan 10 12:53:29 CET 2011


Am 10.01.2011 12:42, schrieb Michael Schnell:
> On 01/10/2011 12:30 PM, Graeme Geldenhuys wrote:
>> The fpGUI UI Designer generates source code.
> I see. I understand that the Lazarus `form designer creates a resource
> that is interpreted by the runtime Form creating process (an at design
> time by the design time Form creating process in a very similar way).
>
> Why does fpGUI go the other way ?
>

If I recall correctly, Graeme dislikes the "resource form" approach used 
by Lazarus and Delphi. (@Graeme: please correct me, if I'm wrong here)

>> You can test this yourself, by creating a LCL-fpGUI based application
>> and using any of the Standard Component Palette components.
> Once I happen to get Lazarus running again ;)
>> LCL's form
>> designer generates a *.lfm file, like normal.
> But I suppose they are not used at all, so using the Lazarus Form
> designer for an fpGUI project does not make any sense. Correct ?

Wrong.

Let's try this another way:
LCL applications don't need to use resource files at all. All components 
can be created at runtime by overriding the constructor (Create) of 
TForm. Normally the constructor searches a resource file, creates all 
child classes that are found in there and assigns the properties/events 
found in the resource file.

Now a pure fpGUI project only does the first: create components at 
runtime in a "special" method.

An LCL-fpGUI application does the same as other LCL applications: it 
searches a resource, creates the child components and assigns the 
properties. This works, because a TButton from the LCL IS NOT a fpGUI 
button (TfpgButton), but a class that (basically) WRAPS a TfpgButton 
(it's the same with the other widget sets btw.). This wrapping code is 
located inside the lcl/interfaces/<widgetset> directories. Only there is 
widgetset specific code used (e.g. only in lcl/interfaces/fpgui units 
from fpGUI are used). The other parts in lcl directory are widgetset 
independant.

Is it more clear now?

Regards,
Sven




More information about the Lazarus mailing list