home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / pascal / dlgdsn3 / testcase.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1992-12-03  |  1.4 KB  |  69 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.   {$ifdef DataRec}
  49.   if Application^.ExecuteDialog(MakeDialog, @DataRec) = cmOk then
  50.     begin
  51.     {do something with data in DataRec}
  52.     end;
  53.   {$else} {DataRec is not always defined}
  54.   Application^.ExecuteDialog(MakeDialog, Nil);
  55.   {$endif}
  56.   ClearEvent(Event);
  57.   end;
  58. end;
  59.  
  60. begin
  61.   {$ifdef DataRec}
  62.   FillChar(DataRec, Sizeof(DataRec), 0);
  63.   {$endif}
  64.   MyApp.Init;
  65.   MyApp.Run;
  66.   MyApp.Done;
  67. end.
  68.  
  69.