[lazarus] Lazarus messaging

Michael Van Canneyt michael.vancanneyt at wisa.be
Mon Jul 12 11:19:46 EDT 1999




On Mon, 12 Jul 1999, Shane Miller wrote:

> Question:
>   What is sent, or how do you control what is sent in the "msg" portion of the message procedure?  What is being sent there?  Can we control it.
> 
> The reason we need to control it is because when dispatching we need some way to send info to the message procedure.  For example:
> 
> GTKTEXT has a signal called INSERT-TEXT. The probelm is it sends the new text, new text length, and position.  How do we use that in our class.  How do we send that?

The Dispatch() procedure accepts any structure as a parameter. Only the first
cardinal must be the message number.

So you could define

  TInsTextMessage = Record
    MsgID : Longint;
    TheText : Pchar;
  end;


And do a
var
  Msg : TInstTextMessage;

begin
  Msg.MsgId:=GTK_INSTEXT;
  Msg.TheText:='some nice text';
  Dispatch(Msg);
end;
---------------------------

This is explained in the docs. I recommend making a record for any kind of
message, and just using these records.

Michael.
  






More information about the Lazarus mailing list