home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / UTILS / DLGDS4 / TESTCASE.PAS < prev    next >
Pascal/Delphi Source File  |  1993-01-11  |  1KB  |  63 lines

  1. {$X+}
  2. program TestCase;
  3.  
  4. uses Dos, Memory, Objects, Drivers, Views, Menus, Dialogs, App, StdDlg,
  5.      Editors, ColorTxt, InpLong, Validate;
  6.  
  7. Const
  8.   cmTry = 150;
  9.   cmButton = 151;
  10.  
  11. type
  12.   TListboxRec = record
  13.     PS : PStringCollection;
  14.     Focused : Integer;
  15.     end;
  16. type
  17.   TMyApp = object(TApplication)
  18.     procedure InitStatusLine; virtual;
  19.     procedure HandleEvent(var Event: TEvent); virtual;
  20.     end;
  21.  
  22. var
  23.   MyApp: TMyApp;
  24.  
  25. procedure TMyApp.InitStatusLine;
  26. var R: TRect;
  27. begin
  28.   GetExtent(R);
  29.   R.A.Y := R.B.Y - 1;
  30.   StatusLine := New(PStatusLine, Init(R,
  31.     NewStatusDef(0, $FFFF,
  32.       NewStatusKey('~Alt-X~ Exit', kbAltX, cmQuit,
  33.       NewStatusKey('~F9~ Try dialog', kbF9, cmTry,
  34.       nil)),
  35.     nil)
  36.   ));
  37. end;
  38.  
  39. (*----Insert MakeDialog here----*)
  40.  
  41.  
  42. procedure TMyApp.HandleEvent(var Event: TEvent);
  43. begin
  44. TApplication.HandleEvent(Event);
  45.  
  46. if (Event.What = evCommand) and (Event.Command = cmTry) then
  47.   begin
  48.   if Application^.ExecuteDialog(MakeDialog, @DataRec) = cmOk then
  49.     begin
  50.     {do something with data in DataRec}
  51.     end;
  52.   ClearEvent(Event);
  53.   end;
  54. end;
  55.  
  56. begin
  57.   FillChar(DataRec, Sizeof(DataRec), 0);
  58.   MyApp.Init;
  59.   MyApp.Run;
  60.   MyApp.Done;
  61. end.
  62.  
  63.