home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / oop.swg / 0022_XCDIALOG.PAS.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-05-28  |  1.9 KB  |  73 lines

  1. {
  2. Johan: this code may help you out.  Keep With it, the learning curve
  3. on TV is very steep.  Try the Fidonet TV Forum in Europe, or better
  4. yet, the Compuserve BPascalA Forum.
  5. }
  6. {xcdialog.int}
  7.  
  8. {$X+}
  9.  
  10. Unit xcdialog;
  11.  
  12. Interface
  13.  
  14. Uses
  15.   Objects,Drivers,Views,Menus,Dialogs,MsgBox,App,Crt,Printer,
  16.   TVXCVars, FmtLine, XCMapL, TVCalcL, TVXCHelp, File_ioL, Dos;
  17.  
  18. Type
  19.   PAspDialog = ^TAspDialog;
  20.   TAspDialog = Object(TDialog)
  21.   end;
  22.  
  23.   PExitDialog = ^TExitDialog;
  24.   TExitDialog = Object(TDialog)
  25.   end;
  26.  
  27. Procedure ExitDialog;  {asks user whether s/he want to quit or not}
  28.  
  29. Implementation
  30.  
  31.  
  32. Procedure ExitDialog;
  33. {■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■}
  34. Var
  35.    Dlg                       : PAspDialog ;
  36.    R                         : TRect ;
  37.    Control, Labl             : PView ;
  38.    Event                     : TEvent;
  39.    iStart                    : Integer;
  40. begin
  41.    R.Assign ( 10 , 2 , 60 , 12 ) ;
  42.    New ( Dlg , Init ( R , 'Exit Confirmation') ) ;
  43.  
  44.    iStart:= (50 - length('Are you SURE you want to Exit?')) div 2;
  45.    {centre Text}
  46.  
  47.    R.Assign ( iStart , 3 , 48 , 4 ) ;
  48.    Control := New ( PStaticText , Init ( R , length('Are you SURE'
  49.                     +' you want to Exit?' ) ) ;
  50.    Dlg^.Insert ( Control ) ;
  51.  
  52.    R.Assign ( 10 , 7 , 21 , 9 ) ;
  53.    Control:= New ( PButton , Init ( R , Words^.get(numYes) ,
  54.                     cmOK , bfDefault ) ) ;
  55.    Control^.HelpCtx          := hcEnter ;
  56.    Dlg^.Insert ( Control ) ;
  57.  
  58.    R.Assign ( 23 , 7 , 36 , 9 ) ;
  59.    Control := New ( PButton,Init(R , 'Cancel', cmCancel , bfNormal ) ) ;
  60.    Control^.HelpCtx          := hcCancelBtn ;
  61.    Dlg^.Insert ( Control ) ;
  62.  
  63.    Dlg^.SelectNext ( False ) ;
  64.  
  65.    if  Desktop^.ExecView (Dlg)  <> cmCancel then
  66.    begin
  67.     Event.What     := evCommand;
  68.     Event.Command  := cmQuit;
  69.     Application^.PutEvent(Event);
  70.    end;
  71.    Dispose(Dlg, Done);
  72. end;
  73.