It isn't exactly a bug but once i tried to set a TShape.checked property. Of course the code wouldn't compile and I didn't get why. When I got the answer on the lazarus forums I was like: "Damn I am stupid".
I think this must be one of the stupidest programming related things that ever happened to me although there are more of these gems.
Yay, I even found the code:
Code:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Image5: TImage;
Image6: TImage;
Image7: TImage;
Image8: TImage;
Image9: TImage;
RadioGroup1: TRadioGroup;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Image1Click(Sender: TObject);
procedure MyRBClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
S: array [1..25] of TShape; //Siedler.
G: array [1..25] of integer; //Goal.
RB: array [1..25] of TRadioButton;
X: integer;
Chosen: integer;
implementation
{ TForm1 }
procedure TForm1.MyRBClick(Sender: TObject);
var
Y: integer;
begin
Y:=1;
Repeat
If S[Chosen].checked = True Then
Chosen:=Y;
Y:=Y+1;
Until Y > X;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
X:=1;
end;
procedure TForm1.Image1Click(Sender: TObject);
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
begin
S[X] := TShape.Create(Application);
S[X].Left := 0;
S[X].Top := 0;
S[X].Width := 50;
S[X].Height := 50;
S[X].Parent := Form1;
S[X].Name := ('MyShape' + IntToStr(X));
S[X].Shape := stCircle;
S[X].Brush.Color := clBlue;
end;
begin
RB[X] :=TRadioButton.create(Application);
RB[X].Left := 5;
RB[X].Top := 5;
RB[X].Parent := Radiogroup1;
RB[X].Name := ('Settler' + IntToStr(X));
RB[X].Caption := ('Siedler nr. ' + IntToStr(X));
RB[X].OnClick := @Form1.MyRBClick;
end;
X:=X+1;
end;
initialization
{$I unit1.lrs}
end.
In my defense, I was kinda new to programming that time.
Cheers!
Bookmarks