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 _______________________________________________ Lazarus mailing list [email protected] http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
