[Lazarus] Web Module not works on Linux

Michael Van Canneyt michael at freepascal.org
Sun Nov 21 15:34:23 CET 2010

On Sun, 21 Nov 2010, Joost van der Sluis wrote:

>> Correct. But:
>> 1. Web applications have their own application object.
>> 2. Web applications have no use for CreateForm(). They don't have forms.
>>     All modules are created dynamically.
>> If someone codes forms.application.createform() in a web or even console app,
>> then he is of course coding something totally wrong :-)
> And how about DATA modules?

Well, just use

  Procedure TCustomWebApplication.CreateForm(AClass : TComponentClass; out Reference);


I use them all the time.

In each case, TWebModule is a descendent of TDataModule, so there is no essential 
difference whatever.

The trick is that the lresources unit sets a hook for InitInheritedComponent in the 
classes unit in it's initialization routine:

procedure InternalInit;
   LazarusResources := TLResourceList.Create;
   // This is where the magic happens...
   RegisterInitComponentHandler(TComponent, @InitResourceComponent);
   PropertiesToSkip := TPropertiesToSkip.Create;

InitInheritedComponent uses this hook to start the streaming system and 
InitInheritedComponent is called in TDatamodule.Create()

Application.Createform does nothing special, in essence it does


So all that is needed for streaming is to include lresources. No more, no less.

Conclusion: no need for the 'nogui' widgetset to use streaming.

(my personal conclusion: dump the nogui widgetset, it serves no purpose except
  encourage wrong programming. But that's up to the lazarus devels to decide.)


More information about the Lazarus mailing list