Názory ke článku Delphi - 5. lekce
17. 10. 2009
unit prace3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var i:boolean;
var text:string;
procedure TForm1.Button1Click(Sender: TObject);
begin
if i=TRUE then
begin
Button1.Caption:='Baaaaaaaaaaaaaaaaaaaaaf, klikni znova a mužeš se leknout znovu';
i:=FALSE;
end
else
begin
Button1.Caption:=text;
i:=TRUE;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
i:=TRUE;
text:='Ahoj pokud klepneš na tlačíto čeká tě překvápko :-)';
end;
end.
17. 10. 2009
unit prace3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var i:boolean;
var text:string;
procedure TForm1.Button1Click(Sender: TObject);
begin
if i=TRUE then
begin
Button1.Caption:='Baaaaaaaaaaaaaaaaaaaaaf, klikni znova a mužeš se leknout znovu';
i:=FALSE;
end
else
begin
Button1.Caption:=text;
i:=TRUE;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
i:=TRUE;
text:='Ahoj pokud klepneš na tlačíto čeká tě překvápko :-)';
end;
end.
6. 2. 2014
Já to provedl takhle:
procedure TForm1.Button1Click(Sender: TObject);
begin
if (i mod 2 = 0) then Button1.Caption := 'Dopredu'
else Button1.Caption := 'Dozadu';
i := i+1;
end;
10. 5. 2014
Není to jednoduší takto??
procedure TForm1.Button1Click(Sender: TObject);
begin
if Button1.Tag = 0 then
begin
Button1.Tag := 1;
Button1.Caption := 'Dopredu';
end
else begin
Button1.Tag := 0;
Button1.Caption := 'Dozadu';
end;
end;