
10.05.2009, 10:21
|
Прохожий
|
|
Регистрация: 09.05.2009
Сообщения: 9
Репутация: 10
|
|
Вопросик по Делфи
У меня чего то отчистка не срабатывает для Edit'ов, может кто подскажет почему
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Label4: TLabel;
Edit3: TEdit;
Label5: TLabel;
Label6: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Button1: TButton;
procedure Edit1Change(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure Edit3Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Edit1Change(Sender: TObject);
var
a:String;
b,c,d,e:integer;
begin
b:=0;
a:=Edit1.Text;
if StrToInt(a)<4 then showmessage ('Можно вводить числа от 4 до 9') else
if StrToInt(a)>9 then showmessage ('Можно вводить числа от 4 до 9') else
c:=StrToInt(Edit1.Text);
b:=sqr(c);
Label1.Caption:= IntToStr(b);
d:=StrToInt(Edit1.Text);
e:=sqr(d)*d;
Label2.Caption:=IntToStr(e);
end;
procedure TForm1.Edit2Change(Sender: TObject);
var
a1:String;
b1,c1,d1,e1:integer;
begin
b1:=0;
a1:=Edit2.Text;
if StrToInt(a1)<4 then showmessage ('Можно вводить числа от 4 до 9') else
if StrToInt(a1)>9 then showmessage ('Можно вводить числа от 4 до 9') else
c1:=StrToInt(Edit2.Text);
b1:=sqr(c1);
Label3.Caption:= IntToStr(b1);
d1:=StrToInt(Edit2.Text);
e1:=sqr(d1)*d1;
Label4.Caption:=IntToStr(e1);
end;
procedure TForm1.Edit3Change(Sender: TObject);
var
a3:String;
b3,c3,d3,e3:integer;
begin
b3:=0;
a3:=Edit3.Text;
if StrToInt(a3)<4 then showmessage ('Можно вводить числа от 4 до 9') else
if StrToInt(a3)>9 then showmessage ('Можно вводить числа от 4 до 9') else
c3:=StrToInt(Edit3.Text);
b3:=sqr(c3);
Label5.Caption:= IntToStr(b3);
d3:=StrToInt(Edit3.Text);
e3:=sqr(d3)*d3;
Label6.Caption:=IntToStr(e3);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text:=' ';
Edit2.Text:=' ';
Edit3.Text:=' ';
Label1.Caption:=' ';
Label2.Caption:=' ';
Label3.Caption:=' ';
Label4.Caption:=' ';
Label5.Caption:=' ';
Label6.Caption:=' ';
end;
end.
Admin: Пользуемся тегами!
|