mam problem w kodzie programu i nie moge sobie z tym poradzic wiec pisze na forum... problem moj polega na tym ze po powtornym kliknieciu na speedbutton krzyżyk zmniania sie na kołko.... i do tego nie moge znaleźć błedu dlaczego nie wyswietla sie komunkat o wygranej .... prosze o pomoc :)
tu jest kod programu ewentualnie moge przeslac moj program do wgladu :) z gory dziekuje za odpowiedzi :)
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls, MPlayer;
type
TMain1stGame = class(TForm)
s1: TSpeedButton;
s2: TSpeedButton;
s3: TSpeedButton;
s4: TSpeedButton;
s5: TSpeedButton;
s6: TSpeedButton;
s7: TSpeedButton;
s8: TSpeedButton;
s9: TSpeedButton;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Button2: TButton;
procedure s1Click(Sender: TObject);
procedure s2Click(Sender: TObject);
procedure s4Click(Sender: TObject);
procedure s3Click(Sender: TObject);
procedure s5Click(Sender: TObject);
procedure s6Click(Sender: TObject);
procedure s7Click(Sender: TObject);
procedure s8Click(Sender: TObject);
procedure s9Click(Sender: TObject);
procedure s1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Main1stGame: TMain1stGame;
implementation
{$R *.dfm}
procedure TMain1stGame.Button2Click(Sender: TObject);
begin
speedbutton1.caption:=edit1.text;
speedbutton2.caption:=edit2.text;
end;
procedure TMain1stGame.s1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if speedbutton1.down=true then begin
speedbutton2.down:=true;
end else
speedbutton1.down:=true;
end;
procedure TMain1stGame.s1Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s1.caption:='X';
end;
if speedbutton2.down=true then begin
s1.caption:='O';
end;
end;
procedure TMain1stGame.s2Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s2.caption:='X';
end;
if speedbutton2.down=true then begin
s2.caption:='O';
end;
end;
procedure TMain1stGame.s3Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s3.caption:='X';
end;
if speedbutton2.down=true then begin
s3.caption:='O';
end;
end;
procedure TMain1stGame.s4Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s4.caption:='X';
end;
if speedbutton2.down=true then begin
s4.caption:='O';
end;
end;
procedure TMain1stGame.s5Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s5.caption:='X';
end;
if speedbutton2.down=true then begin
s5.caption:='O';
end;
end;
procedure TMain1stGame.s6Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s6.caption:='X';
end;
if speedbutton2.down=true then begin
s6.caption:='O';
end;
end;
procedure TMain1stGame.s7Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s7.caption:='X';
end;
if speedbutton2.down=true then begin
s7.caption:='O';
end;
end;
procedure TMain1stGame.s8Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s8.caption:='X';
end;
if speedbutton2.down=true then begin
s8.caption:='O';
end;
end;
procedure TMain1stGame.s9Click(Sender: TObject);
begin
if speedbutton1.down=true then begin {Jeżeli przycisk speedbutton1 będzie wciśnięty to na przycisku s1 ujrzysz literę ‘X’ – w przeciwnym wypadku – ‘O’.}
s9.caption:='X';
end;
if speedbutton2.down=true then begin
s9.caption:='O';
end;
end;
procedure TForm1wygranaTimer(Sender: TObject); var s1: TSpeedButton;
s2: TSpeedButton;
s3: TSpeedButton;
s4: TSpeedButton;
s5: TSpeedButton;
s6: TSpeedButton;
s7: TSpeedButton;
s8: TSpeedButton;
s9: TSpeedButton;
begin
if((((s1.caption='X') and (s2.caption='X') and (s3.caption='X'))) or
(((s4.caption='X') and (s5.caption='X') and (s6.caption='X'))) or
(((s7.caption='X') and (s8.caption='X') and (s9.caption='X'))) or
(((s1.caption='X') and (s4.caption='X') and (s7.caption='X'))) or
(((s2.caption='X') and (s5.caption='X') and (s8.caption='X'))) or
(((s3.caption='X') and (s6.caption='X') and (s9.caption='X'))) or
(((s1.caption='X') and (s5.caption='X') and (s9.caption='X'))) or
(((s3.caption='X') and (s5.caption='X') and (s7.caption='X'))) or
(((s1.caption='O') and (s2.caption='O') and (s3.caption='O'))) or
(((s4.caption='O') and (s5.caption='O') and (s6.caption='O'))) or
(((s7.caption='O') and (s8.caption='O') and (s9.caption='O'))) or
(((s1.caption='O') and (s4.caption='O') and (s7.caption='O'))) or
(((s2.caption='O') and (s5.caption='O') and (s8.caption='O'))) or
(((s3.caption='O') and (s6.caption='O') and (s9.caption='O'))) or
(((s1.caption='O') and (s5.caption='O') and (s9.caption='O'))) or
(((s3.caption='O') and (s5.caption='O') and (s7.caption='O')))) then
begin
ShowMessage('Wygrana');
end;
end;
procedure TMain1stGame.Button1Click(Sender: TObject);
begin
begin
s1.caption:='';{wymazanie tekstu z przycisków}
s2.caption:='';
s3.caption:='';
s4.caption:='';
s5.caption:='';
s6.caption:='';
s7.caption:='';
s8.caption:='';
s9.caption:='';
end;
end;
end.