[lazarus] LM_CLICK idea

Peter Vreman pfvreman at wins.uva.nl
Thu Jul 8 05:29:48 EDT 1999


> I was actually planning on setting LM_CLICK to an integer value and then in
> gtkint.pp it woulds say:
> 
> 
> case MESSAGE of
>     LM_CLICK : Begin
>     ...
>                         end;
> etc.
> 
> I didn't come up with generic names for LM_CLICK or anything.   I used
> LM_CHECKRESIZE etc.  even though it's a bit GTK specific.  We can change
> them later if we wish.
> By assigning them a nuber, we are forced in GTKINT.PP to assign signal a
> string value based on that number, BUT this allows us to do this
> 
> Procedure DoClick(var msg); message LM_CLICK;
> 
> and because that's an INTEGER value we can call Dispatch instead of
> DISPATCHSTR .  At least I think we can.  That will help us remain more
> multiplatform because dispatchstr is what SHOULD be called......
You can't use string constants becuase then you need recompiling of the
whole application when you want an other toolkit. Using integers is a
fast (a lot less string compares) alternative. You need to write for every
toolkit a conversion routine:

function getmessageid(s:string):integer;
begin
  walk through a table and return the correspondenting id
end;

the table can then be sorted so a binary search maybe with some hashing
can be used.

The compiler also uses such trick for all needed tokens which are futher
handled like enumerated in the compiler.


Peter






More information about the Lazarus mailing list