[Lazarus] Setting String Properties of Custom Component = AV

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


On Thu, 01 May 2008 21:58:20 -0400
Lee Jenkins <lee at datatrakpos.com> wrote:

>[...]
> >>>> 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
> 
> They were, but I had to change the mode to Delphi to get the String
> properties from throwing an AV when I tried to set them at design
> time.

Then you forgot the {$H+} switch to enable ansistrings.

Every lazarus unit begins with:
{$mode ObjFPC}{$H+}

Mattias



More information about the Lazarus mailing list