[Lazarus] Error: identifier idents no member "SetSpecificCaption" (buttonlist.pas)

ik idokan at gmail.com
Tue Aug 31 08:49:24 CEST 2010


Hi Peter,

As I wrote in the original mail, you should create it, to the code. I
suggested you to create a new class driven from the TCustomButtonList that
will have it, and merely gave you a pointer how to do it, but I wrote you
that you are the one that should add it to your code, due to your needs,
that are not existed in the current code base.

Ido


2010/8/31 Peter E Williams <foss.game.pascal.developer at iinet.net.au>

> Hi Lazarus list,
>
> I am making public a private message between myself and Ido, re some
> changes to ButtonList.pas.
>
> Please find attached buttonlist.pas and testunit1.pas which contains the
> relevant code.
>
> > testunit1.pas(65,9) Error: identifier idents no member
> > "SetSpecificCaption"
> > testunit1.pas(66,20) Error: Incompatible types: got "untyped" expected
> > "<procedure variable type of procedure(TObject) of object;Register>"
> > testunit1.pas(75) Fatal: There were 2 errors compiling module,
> > stopping
> >
> > lines 65 & 66 follow:
> >     sg1.SetSpecificCaption( b, X_str + inttostr(b) );
> >     sg1.OnClick := Button1Click(self);
> >
>
> >From buttonlist.pas
> > procedure TCustomButtonList.SetSpecificCaption(num : integer; Str :
> > String);
> > begin
> >   if (num > High(FButtons)) or (num < Low(FButtons)) then
> >     raise Exception.Create('Set Caption Out of range');
> >
> >   FButtons[num].Caption := Str;
> > end;
> >
>
> I would appreciate your help debugging these errors. :-)))
>
> Best Regards,
>        PEW (Peter)
> Hobart, Tasmania, Australia
>
> >
> > On Mon, 2010-08-30 at 22:45 +0300, ik wrote:
> > > Hi Peter,
> > >
> > > Your requests are not supported by the component, but it can be
> > > rewritten like so:
> > >
> > > TAdvancedCustomButtonList = class(TCustomButtonList)
> > >
> > > Note that you have access to FButtons (it's the actual array of the
> > > buttons).
> > >
> > > so a procedure like so can be written:
> > >
> > > procedure TAdvancedCustomButtonList.SetSpecificCaption(num :
> > integer;
> > > Caption : String);
> > > begin
> > >   if num > High(FButtons) or num < Low(FButtons) then
> > >     raise Exception.Create('Out of range');
> > >
> > >   FButtons[num].Caption := Caption;
> > > end;
> > >
> > > and also:
> > >
> > > procedure TAdvancedCustomButtonList.SetFont(num : integer; Font :
> > > TFont);
> > > begin
> > >   if num >Hi Lazarus list,
>
> I am making public a private message between myself and Ido, re some
> changes to ButtonList.pas.
>
> Please find attached buttonlist.pas and testunit1.pas which contains the
> relevant code.
>
> > testunit1.pas(65,9) Error: identifier idents no member
> > "SetSpecificCaption"
> > testunit1.pas(66,20) Error: Incompatible types: got "untyped" expected
> > "<procedure variable type of procedure(TObject) of object;Register>"
> > testunit1.pas(75) Fatal: There were 2 errors compiling module,
> > stopping
> >
> > lines 65 & 66 follow:
> >     sg1.SetSpecificCaption( b, X_str + inttostr(b) );
> >     sg1.OnClick := Button1Click(self);
> >
>
> >From buttonlist.pas
> > procedure TCustomButtonList.SetSpecificCaption(num : integer; Str :
> > String);
> > begin
> >   if (num > High(FButtons)) or (num < Low(FButtons)) then
> >     raise Exception.Create('Set Caption Out of range');
> >
> >   FButtons[num].Caption := Str;
> > end;
> >
>
> I would appreciate your help debugging these errors. :-)))
>
> Best Regards,
>        PEW (Peter)
> Hobart, Tasmania, Australia
>
> >
> > On Mon, 2010-08-30 at 22:45 +0300, ik wrote:
> > > Hi Peter,
> > >
> > > Your requests are not supported by the component, but it can be
> > > rewritten like so:
> > >
> > > TAdvancedCustomButtonList = class(TCustomButtonList)
> > >
> > > Note that you have access to FButtons (it's the actual array of the
> > > buttons).
> > >
> > > so a procedure like so can be written:
> > >
> > > procedure TAdvancedCustomButtonList.SetSpecificCaption(num :
> > integer;
> > > Caption : String);
> > > begin
> > >   if num > High(FButtons) or num < Low(FButtons) then
> > >     raise Exception.Create('Out of range');
> > >
> > >   FButtons[num].Caption := Caption;
> > > end;
> > >
> > > and also:
> > >
> > > procedure TAdvancedCustomButtonList.SetFont(num : integer; Font :
> > > TFont);
> > > begin
> > >   if num > High(FButtons) or num < Low(FButtons) then
> > >     raise Exception.Create('Out of range');
> > >
> > >   FButtons[num].Font.Assign(Font);
> > > end;
> > >
> > > Please note that I have not tried it myself, but that's the idea of
> > > how to do it.
> > >
> > > I hope that helps, and feel free to ask more questions, or to be
> > > pointed for additional information.
> > >
> > > Ido
> > >
> > > http://ik.homelinux.org/
> > >
> > >
> > > On Mon, Aug 30, 2010 at 22:06, Peter E Williams
> > > <foss.game.pascal.developer at iinet.net.au> wrote:
> > >         Hi Ido,
> > >
> > >         I am using your component, ButtonList, and creating it at
> > >         runtime. I am
> > >         having some problems doing the following:
> > >
> > >         Assigning a caption to the x'th button:
> > >
> > >         what I want to do is this...
> > >
> > >         var
> > >          BtnList : TButtonList;
> > >
> > >         begin
> > >          BtnList := TButtonList.Create(self);
> > >          BtnList.parent := self;
> > >          BtnList.visible := true;
> > >          BtnList.count := 8;
> > >
> > >         // this next line is the problem
> > >
> > >          BtnList.caption[x] := 'hello';
> > >
> > >         but I see that you have a procedure 'Captions' which accepts
> > a
> > >         TStringList as it's parameter. I don't have a TStringList,
> > and
> > >         I don't
> > >         want to reset every caption, only the x'th one.
> > >
> > >         Likewise, I want to set the font color for the x'th button,
> > >         like:
> > >
> > >         BtnList.font[x].color := clBlue;
> > >
> > >         Can I do this or something similar???
> > >
> > >         Best Regards,
> > >                PEW
> > >         Hobart, Tasmania, Australia
> > >
> > >         --
> > >         Proudly developing Quality Cross Platform Open Source Games
> > >         Since 1970 with a Commodore PET 4016 with 16 KRAM
> > >         http://pews-freeware-games.org (<--- brand new)
> > >          High(FButtons) or num < Low(FButtons) then
> > >     raise Exception.Create('Out of range');
> > >
> > >   FButtons[num].Font.Assign(Font);
> > > end;
> > >
> > > Please note that I have not tried it myself, but that's the idea of
> > > how to do it.
> > >
> > > I hope that helps, and feel free to ask more questions, or to be
> > > pointed for additional information.
> > >
> > > Ido
> > >
> > > http://ik.homelinux.org/
> > >
> > >
> > > On Mon, Aug 30, 2010 at 22:06, Peter E Williams
> > > <foss.game.pascal.developer at iinet.net.au> wrote:
> > >         Hi Ido,
> > >
> > >         I am using your component, ButtonList, and creating it at
> > >         runtime. I am
> > >         having some problems doing the following:
> > >
> > >         Assigning a caption to the x'th button:
> > >
> > >         what I want to do is this...
> > >
> > >         var
> > >          BtnList : TButtonList;
> > >
> > >         begin
> > >          BtnList := TButtonList.Create(self);
> > >          BtnList.parent := self;
> > >          BtnList.visible := true;
> > >          BtnList.count := 8;
> > >
> > >         // this next line is the problem
> > >
> > >          BtnList.caption[x] := 'hello';
> > >
> > >         but I see that you have a procedure 'Captions' which accepts
> > a
> > >         TStringList as it's parameter. I don't have a TStringList,
> > and
> > >         I don't
> > >         want to reset every caption, only the x'th one.
> > >
> > >         Likewise, I want to set the font color for the x'th button,
> > >         like:
> > >
> > >         BtnList.font[x].color := clBlue;
> > >
> > >         Can I do this or something similar???
> > >
> > >         Best Regards,
> > >                PEW
> > >         Hobart, Tasmania, Australia
> > >
> > >         --
> > >         Proudly developing Quality Cross Platform Open Source Games
> > >         Since 1970 with a Commodore PET 4016 with 16 KRAM
> > >         http://pews-freeware-games.org (<--- brand new)
> > >
> --
> Proudly developing Quality Cross Platform Open Source Games
> Since 1970 with a Commodore PET 4016 with 16 KRAM
> http://pews-freeware-games.org (<--- brand new)
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100831/2dee1c5a/attachment-0004.html>


More information about the Lazarus mailing list