Mattias Gaertner wrote 30 lines
On Thu, 01 May 2008 19:57:33 -0400
Lee Jenkins 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
That was it, Mattias. Thank you, I am learning quite a bit about component writing which is a new endeavor for me.
I have just one more problem with this component which is centering the text vertically. I had posted a separate thread above concerning this and once I figure out how to get the text to center vertically, I should this component right where I want it :)
Thanks again, everyone's help is most appreciated.
Warm Regards,
Lee
"When my company started out, we were really, really, really, really small.
Now...we're just really small."