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);

Or
  TDataModule.Create(Whatever);

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;
begin
  LazarusResources := TLResourceList.Create;
  // This is where the magic happens...
  RegisterInitComponentHandler(TComponent, @InitResourceComponent);
  PropertiesToSkip := TPropertiesToSkip.Create;
end;

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

  Reference:=AClass.Create(Self);

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.)

Michael.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to