home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_PAS / KEYCTRL.ZIP / DKEYCTRL.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-07  |  3KB  |  140 lines

  1. unit DKEYCTRL;
  2.  
  3. interface
  4.  
  5. uses Drivers, Objects, Views, Dialogs,KeyCtrl,App,CmKey;
  6.  
  7.  
  8. type
  9.   DataRec = record
  10.     Name    : String[20];
  11.     Address : String[20];
  12.     Zip     : String[8];
  13.     Place   : String[30];
  14.     Sexe    : Word;
  15.     end;
  16.   PDataRec = ^DataRec;
  17.  
  18.   { TKeyCtrlDialog }
  19.  
  20.   PKeyCtrlDialog = ^TKeyCtrlDialog;
  21.   TKeyCtrlDialog = object(TDialog)
  22.     constructor Init;
  23.     procedure HandleEvent(var Event:tevent); Virtual;
  24.   end;
  25.  
  26. implementation
  27.  
  28. { TKeyCtrlDialog }
  29.  
  30. constructor TKeyCtrlDialog.Init;
  31. var
  32.   R       : TRect;
  33.   Control : PView;
  34.   MyHB    : PHorizontalButtons;
  35.   Nr      : Byte;
  36. begin
  37.   Nr:=1;
  38.   while (Nr<WinMax) and (Winact[nr]=true) do inc(nr);
  39.   inc(WinCount);
  40.   if wincount>=winmax then disablecommands([cmdemo]);
  41.   WinAct[NR]:=TRUE;
  42.   getextent(r);
  43.   r.a.x:=nr;
  44.   r.b.x:=r.a.x+54;
  45.   r.a.y:=nr;
  46.   r.b.y:=r.a.y+11;
  47.  
  48.   inherited Init(R, 'Demo KeyControl');
  49.   Palette := dpCyanDialog;
  50.   Number:=Nr;
  51.  
  52.   R.Assign(12, 2, 34, 3);
  53.   Control := New(PMyInputline, Init(R, 20));
  54.   Insert(Control);
  55.  
  56.   R.Assign(1, 2, 12, 3);
  57.   Insert(New(PLabel, Init(R, '~N~ame    : ', Control)));
  58.  
  59.   R.Assign(12, 3, 52, 4);
  60.   Control := New(PMyInputline, Init(R, 38));
  61.   Insert(Control);
  62.  
  63.   R.Assign(1, 3, 12, 4);
  64.   Insert(New(PLabel, Init(R, '~A~ddress : ', Control)));
  65.  
  66.   R.Assign(12, 4, 22, 5);
  67.   Control := New(PMyInputline, Init(R, 8));
  68.   Insert(Control);
  69.  
  70.   R.Assign(1, 4, 12, 5);
  71.   Insert(New(PLabel, Init(R, '~Z~ipCode : ', Control)));
  72.  
  73.   R.Assign(32, 4, 52, 5);
  74.   Control := New(PMyInputline, Init(R, 30));
  75.   Insert(Control);
  76.  
  77.   R.Assign(23, 4, 32, 5);
  78.   Insert(New(PLabel, Init(R, '~P~lace : ', Control)));
  79.  
  80.   R.Assign(12, 6, 35, 7);
  81.   Control := New(PHorizontalButtons, Init(R,
  82.     NewSItem('Male ',
  83.     NewSItem('Female', Nil))));
  84.   Insert(Control);
  85.   MyHB:=PHorizontalButtons(Control);
  86.   R.Assign(1, 6, 12, 7);
  87.   Insert(New(PLabel, Init(R, '~S~exe    : ', Control)));
  88.  
  89.   R.Assign(22, 8, 32, 10);
  90.   Control := New(PMyButton, Init(R, '~M~/F', cmtoggle, bfNormal));
  91.   Insert(Control);
  92.   MyHb^.PtrButton:=PmyButton(Control);
  93.  
  94.   R.Assign(32, 8, 42, 10);
  95.   Control := New(PMyButton, Init(R, 'O~k~', cmOK, bfDefault));
  96.   Insert(Control);
  97.  
  98.   R.Assign(42, 8, 52, 10);
  99.   Control := New(PMyButton, Init(R, '~C~ancel', cmcancel, bfNormal));
  100.   Insert(Control);
  101.  
  102.   getextent(r);
  103.   inc(r.a.x,6);dec(r.b.x,7);
  104.   r.a.y:=r.b.y-1;
  105.   control:=new(pstatictext,init(r,'Use Crsr_UP and Crsr_down to Walk Fields.'));
  106.   insert(control);
  107.  
  108.   SelectNext(False);
  109. end;
  110.  
  111. procedure TKeyCtrlDialog.HandleEvent(var Event:Tevent);
  112.  
  113. Begin
  114.   if event.what=evnothing then exit;
  115.  
  116.   if event.what=evcommand then
  117.    case event.command of
  118.      cmcancel,
  119.      cmok    ,
  120.      cmclose ,
  121.      cmquit  ,
  122.      cmclose :
  123.        begin
  124.          if state and sfmodal <>0 then endmodal(event.command)
  125.          else Free;
  126.          dec(winCount);
  127.          WinAct[Number]:=False;
  128.          enablecommands([cmdemo]);
  129.          if event.command <> cmquit then
  130.             ClearEvent(event);
  131.          exit;
  132.        end;
  133.    end;
  134.   inherited handleevent(event);
  135. end;
  136.  
  137.  
  138.  
  139. end.
  140.