[Lazarus] lazarus on mac

Bee bisma at brawijaya.ac.id
Fri May 2 13:56:34 CEST 2008


Lee Jenkins wrote:
>>>> Also, I'm having another problem with this component.  It's a
>>>> TShape descendant and I have hooked up mousedown and mouseup events
>>>> to change Pen.color and Brush.Color properties to different values
>>>> in order to indicate visual feedback.
>> MousDown and MouseUp events are handled by the IDE (designer).
>>
>>
> 
> Sorry Mattias, I wasn't clear enough.  When I site the component at *design 
> time*, the mouse down events do not fire at *runtime*.  In the create event, I 
> have this:
> 
> constructor TPOSButton.Create(AOwner: TComponent);
> begin
>    inherited Create(AOwner);
>    Self.OnMouseDown := HandleMouseDown;  // <== handlers with correct signatures.
>    self.OnMouseUp := HandleMouseUp;
> end;
> 
>>> Setting Mode to Delphi fixed it, but I'm curious as to how to get
>>> this to work in FPC mode.
Hi,

In FPC mode, your event assignments should prefix with '@' like this:

constructor TPOSButton.Create(AOwner: TComponent);
begin
   inherited Create(AOwner);
   Self.OnMouseDown := @HandleMouseDown;  // <== handlers with correct signatures.
   self.OnMouseUp := @HandleMouseUp;
end;

HTH,
Funky Beast



More information about the Lazarus mailing list