[lazarus] My opinions

Florian Klaempfl Florian.Klaempfl at gmx.de
Sat Oct 23 11:22:23 EDT 1999


I followed up the lazarus development for some time now and I think that the message
solution isn't a good way, i.e. sending a message for every small piece of action.
I thought a little bit more about that topic and I think to get an idea
how to support multiple GUI APIs without a lot of ifdefs and without breaking
delphi compatiblity too much:

Take the following class tree:

TAbstractCanvas
   |
   |---TGTKCanvas
   |---TWin32Canvas
   |---TQtCanvas
   ....

TAbtractCanvas implements the common stuff, while the TGTKCanvas etc implements the system dependend
stuff
Now you'll ask: where is TCanvas?
TCanvas should be declared 

TCanvas : class of TAbstractCanvas

and depending on the GUI API TCanvas is initializes appropriatly. The constructors must be
virtual, of course. 

BTW: This solution allows even to support multiple APIs with _one executable_, you have only to
set the class variables inn the init code.

If this isn't appliable to the whol class library I think it's useful for some seperated classes
as TCanvas to avoid the large overhead of the message passing.






More information about the Lazarus mailing list