home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_PAS
/
KEYCTRL.ZIP
/
DKEYCTRL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-01-07
|
3KB
|
140 lines
unit DKEYCTRL;
interface
uses Drivers, Objects, Views, Dialogs,KeyCtrl,App,CmKey;
type
DataRec = record
Name : String[20];
Address : String[20];
Zip : String[8];
Place : String[30];
Sexe : Word;
end;
PDataRec = ^DataRec;
{ TKeyCtrlDialog }
PKeyCtrlDialog = ^TKeyCtrlDialog;
TKeyCtrlDialog = object(TDialog)
constructor Init;
procedure HandleEvent(var Event:tevent); Virtual;
end;
implementation
{ TKeyCtrlDialog }
constructor TKeyCtrlDialog.Init;
var
R : TRect;
Control : PView;
MyHB : PHorizontalButtons;
Nr : Byte;
begin
Nr:=1;
while (Nr<WinMax) and (Winact[nr]=true) do inc(nr);
inc(WinCount);
if wincount>=winmax then disablecommands([cmdemo]);
WinAct[NR]:=TRUE;
getextent(r);
r.a.x:=nr;
r.b.x:=r.a.x+54;
r.a.y:=nr;
r.b.y:=r.a.y+11;
inherited Init(R, 'Demo KeyControl');
Palette := dpCyanDialog;
Number:=Nr;
R.Assign(12, 2, 34, 3);
Control := New(PMyInputline, Init(R, 20));
Insert(Control);
R.Assign(1, 2, 12, 3);
Insert(New(PLabel, Init(R, '~N~ame : ', Control)));
R.Assign(12, 3, 52, 4);
Control := New(PMyInputline, Init(R, 38));
Insert(Control);
R.Assign(1, 3, 12, 4);
Insert(New(PLabel, Init(R, '~A~ddress : ', Control)));
R.Assign(12, 4, 22, 5);
Control := New(PMyInputline, Init(R, 8));
Insert(Control);
R.Assign(1, 4, 12, 5);
Insert(New(PLabel, Init(R, '~Z~ipCode : ', Control)));
R.Assign(32, 4, 52, 5);
Control := New(PMyInputline, Init(R, 30));
Insert(Control);
R.Assign(23, 4, 32, 5);
Insert(New(PLabel, Init(R, '~P~lace : ', Control)));
R.Assign(12, 6, 35, 7);
Control := New(PHorizontalButtons, Init(R,
NewSItem('Male ',
NewSItem('Female', Nil))));
Insert(Control);
MyHB:=PHorizontalButtons(Control);
R.Assign(1, 6, 12, 7);
Insert(New(PLabel, Init(R, '~S~exe : ', Control)));
R.Assign(22, 8, 32, 10);
Control := New(PMyButton, Init(R, '~M~/F', cmtoggle, bfNormal));
Insert(Control);
MyHb^.PtrButton:=PmyButton(Control);
R.Assign(32, 8, 42, 10);
Control := New(PMyButton, Init(R, 'O~k~', cmOK, bfDefault));
Insert(Control);
R.Assign(42, 8, 52, 10);
Control := New(PMyButton, Init(R, '~C~ancel', cmcancel, bfNormal));
Insert(Control);
getextent(r);
inc(r.a.x,6);dec(r.b.x,7);
r.a.y:=r.b.y-1;
control:=new(pstatictext,init(r,'Use Crsr_UP and Crsr_down to Walk Fields.'));
insert(control);
SelectNext(False);
end;
procedure TKeyCtrlDialog.HandleEvent(var Event:Tevent);
Begin
if event.what=evnothing then exit;
if event.what=evcommand then
case event.command of
cmcancel,
cmok ,
cmclose ,
cmquit ,
cmclose :
begin
if state and sfmodal <>0 then endmodal(event.command)
else Free;
dec(winCount);
WinAct[Number]:=False;
enablecommands([cmdemo]);
if event.command <> cmquit then
ClearEvent(event);
exit;
end;
end;
inherited handleevent(event);
end;
end.