<div dir="ltr">Please see fixes inline.<br><br clear="all"><a href="http://ik.homelinux.org/">http://ik.homelinux.org/</a><br>
<br><br><div class="gmail_quote">2010/9/1 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 and Alvaro,<br>
<br>
I am trying to write a short test project for buttonlist.pas which is a<br>
modified version of Ido's untbuttonlist.pas ... but with some extra<br>
procedures and functions. The problem I am now having is that there is<br>
no sample project showing how to write a ButtonClick Handler. Lazarus<br>
complains that it is not a function, although it is declared as a<br>
procedure.<br>
<br>
from buttonlist.pas, type declaration:<br>
  TButtonClick = procedure (Index : Word) of object;<br>
<br>
//line 33<br>
procedure TForm1.MyButtonsClickHandler(index: word);<br>
<br>
testunit1.pas(33,39) Error: overloaded identifier<br>
"MyButtonsClickHandler" isn't a function<br>
testunit1.pas(33,18) Error: function header doesn't match any method of<br>
this class "TForm1.MyButtonsClickHandler$33(Word);"<br>
<br>
//line 58<br>
  MyButtons.SetLayoutDirection := ldHorizontal;<br>
<br>
testunit1.pas(58,13) Error: identifier idents no member<br>
"SetLayoutDirection"<br>
testunit1.pas(74) Fatal: There were 3 errors compiling module, stopping<br>
<br>
unit testunit1;<br>
<br>
{$mode objfpc}{$H+}<br>
<br>
interface<br>
<br>
uses<br>
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics,<br>
Dialogs,<br>
  StdCtrls, ButtonList;<br>
<br>
type<br>
<br>
  { TForm1 }<br>
<br>
  TForm1 = class(TForm)<br>
    procedure FormCreate(Sender: TObject);<br>
  private<br>
    { private declarations }<br>
  public<br>
    { public declarations }<br>
    MyButtons: TButtonList;<br>
<br>
{ from buttonlist.pas<br>
type<br>
  TLayoutDirection = (ldHorizontal, ldVertical);<br>
[...]<br>
  TButtonClick = procedure (Index : Word) of object;<br>
}<br>
<br>
    <span style="color: rgb(0, 0, 153);">procedure MyButtonsClickHandler(Index : Word);</span><br>
    constructor Create(aOwner: TComponent); override;<br>
  end;<br>
<br>
var<br>
  Form1: TForm1;<br>
<br>
implementation<br>
<br>
{ TForm1 }<br>
<br>
procedure TForm1.MyButtonsClickHandler(index: word);<br>
begin<br>
  showmessage( 'You clicked button number ' + inttostr(index) );<br>
end;<br>
<br>
constructor TForm1.Create(aOwner: TComponent);<br>
begin<br>
  inherited;<br>
  MyButtons.OnButtonClick := <span style="color: rgb(0, 0, 153);">@MyButtonsClickHandler</span>;<br>
end;<br>
<br>
procedure TForm1.FormCreate(Sender: TObject);<br>
var<br>
  b: integer;<br>
<br>
const<br>
  max_level = 8;<br>
  max_byte = 255;<br>
  demo = false;<br>
  X_str = 'X';<br>
  O_str = 'O';<br>
  empty_cell = '';<br>
<br>
begin<br>
//  MyButtons := TButtonList.Create(self);<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
  <span style="color: rgb(0, 0, 153);">MyButtons.LayoutDirection := ldHorizontal;</span><br></blockquote><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


  MyButtons.Count := max_level;<br>
  MyButtons.parent := self;<br>
  MyButtons.visible := True;<br>
<br>
  for b := 1 to max_level do<br>
  begin<br>
    MyButtons.SetSpecificCaption( b, X_str + inttostr(b) );<br>
  end;<br>
end;<br>
<br>
initialization<br>
  {$I testunit1.lrs}<br>
<br>
end.<br>
<font color="#888888"><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>
</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>