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