[Lazarus] Setting String Properties of Custom Component = AV

Mattias Gaertner nc-gaertnma at netcologne.de
Fri May 2 10:48:55 CEST 2008


On Thu, 01 May 2008 19:57:33 -0400
Lee Jenkins <lee at datatrakpos.com> wrote:

>[...]
> 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;

Components should not set their own events, but instead override the
methods. For example

  protected
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,
           Y: Integer); override;

procedure TPOSButton.MouseDown(Button: TMouseButton; Shift:
TShiftState; X, Y: Integer);
begin
  inherited MouseDown(Button, Shift, X, Y);
end;


Mattias



More information about the Lazarus mailing list