home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 December
/
Chip_2001-12_cd1.bin
/
zkuste
/
delphi
/
kompon
/
d23456
/
CAJSCRTP.ZIP
/
demo_kylix
/
FormTest.ifs
< prev
next >
Wrap
Text File
|
2001-05-14
|
2KB
|
106 lines
Program IFSTest;
var
F, Form: TForm;
Label: TLabel;
Button: TButton;
Edit: TEdit;
Stop: Boolean;
procedure MyOnCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := Stop;
end;
procedure c2(sender: TObject);
begin
f.Close;
end;
procedure buttonclick(sender: TObject);
begin
if Length(Edit.Text) < 5 then
begin
f := TForm.Create;
with f do
begin
Width := 100;
Height := 100;
BorderStyle := bsDialog;
BorderIcons := 0;
Caption := 'Error';
Center;
with TLabel.Create(F) do
begin
Left := 10;
Top := 10;
Width := 100;
Height := 50;
Caption := 'Invalid name';
end;
With TButton.Create(F) do
begin
Left:=10;
Top := 40;
Caption := 'OK';
Default := True;
Cancel := True;
OnClick := @C2;
end;
Visible := True;
form.Visible := False;
while f.Visible do
begin
ProcessMessages;
end;
Form.Visible := True;
end;
end else begin
writeln('debug:'+Edit.Text);
Stop := True;
Form.Close;
end;
end;
Begin
Form := TForm.Create;
Form.Width := 400;
Form.Height := 300;
Form.BorderStyle := bsDialog;
Form.BorderIcons := 0;
Form.OnCloseQuery := @MyOnCloseQuery;
Form.Caption := 'Name';
Form.Center;
Label := TLabel.Create(Form);
Label.Top := 120;
Label.Left := 160;
Label.Caption := 'Please type in your name:';
Edit := TEdit.Create(Form);
Edit.FontName := 'Tahoma';
Edit.SetBounds(160,160,80,24);
Button := TButton.Create(Form);
Button.Left := 160;
Button.Top := 200;
Button.Width := 80;
Button.Height := 24;
Button.Caption := '&OK';
Button.OnClick := @buttonclick ;
Button.Default := True;
with TMemo.Create(Form) do
begin
Left := 10;
Width := 380;
Top := 10;
Height := 100;
Text := 'Welcome to Form Test.'#13#10#13#10'Type here your name (min 5 letters). You can''t exit this demo without it.';
Color := 0;
FontColor := $FFFFFF;
Readonly := True;
end;
Form.Visible := true;
stop := false;
while Form.Visible do
begin
ProcessMessages;
end;
Button.Free;
Form.Free;
End.