[lazarus] Latest source is attached.

michael at tfdec1.fys.kuleuven.ac.be michael at tfdec1.fys.kuleuven.ac.be
Sat Jul 3 05:36:15 EDT 1999




On Fri, 2 Jul 1999, Michael A. Hess wrote:

> Shane Miller wrote:
> > 
> 
> Let me throw my hat into this fire. I hope this doesn't confuse the
> issue. FPC already has a messaging system built in. I was having
> problems getting it working a few weeks ago and due to other commitments
> that many of us seemed to have at the same time I didn't get much
> further with it. I had planned on doing some this weekend. Any way here
> is how I had started trying to do the messaging thing.
> 
> If you remember I first started with the GUIapi.pp file. This was
> suppose to be the file that was standard as far as access from the FCL
> but it would have different version for each type of API (GTK, QT) that
> you are using. It relys on the messaging built into the FPC.
> 
> I am using the TForm as an example since that is what I was working
> with. First you would create the message routines in the class
> definition like thus:
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> TCustomForm = class(TWinControl)
> .
> .
> .
> protected
>    procedure DoDestroy(Self : TCustomForm); message 'destroy';
>    procedure DoShow(Self : TCustomForm); message 'show';
>    procedure DoFocus(Self : TCustomForm); message 'focus';
> .
> .
> .
> end;
> 
> procedure TCustomForm.DoDestroy(Self : TCustomForm);
> begin
>    if Assigned (FOnDestroy) then
>       FOnDestroy(Self);
> end;  
> 
> { do the same for DoShow and DoFocus }
> 
> constructor TCustomForm.Create(AOwner : TComponent);
> begin
> .
> .
> .
> GUIAPI_Set_Callback('destroy', Self)
> GUIAPI_Set_Callback('show', Self)
> GUIAPI_Set_Callback('focus', Self)

This is essentially correct.

Do not forget that the callback must go to dispatchstr() and not to
the DoDestroy. The Dispatchstr will call the DoDestroy by itself.

Good work, Michael (H).

Michael (V.C).






More information about the Lazarus mailing list