home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / HISPEED2.LZH / GEMDEMO / FORMS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-07-02  |  3KB  |  83 lines

  1. {-------------------------------------------------------------------------
  2.                 HighSpeed Pascal GEM-interface demo program
  3.  
  4.                              FORM LIBRARY DEMO
  5.  
  6.                       Copyright (c) 1990 by D-House I
  7.                             All rights reserved
  8.  
  9.                       Programmed by Martin Eskildsen
  10. -------------------------------------------------------------------------}
  11. {$R-,S-,D+}
  12.  
  13. program Forms;
  14.  
  15. uses GemAES, GemVDI, GemDecl, GemInterface;
  16.  
  17. var
  18.   x, y, w, h    : Integer;      { message box' centered position }
  19.   smallX,
  20.   smallY,
  21.   smallW,
  22.   smallH        : Integer;      { reduced x, y, w, h values     }
  23.   button        : Integer;      { return value from form_alert  }
  24.   msg           : String;       { form_alert message string     }
  25.  
  26. begin
  27.   if Init_Gem then begin
  28.     Message('Welcome to the Form library demonstration!');
  29.  
  30.     Message('First, we''ll look at an alert box');
  31.     msg := '[2][ | Nice, isn''t it? ][ Yeah | Oh no! ]'#0;
  32.     button := form_alert(1, msg[1]);    { the "Yeah" button is default }
  33.  
  34.     Message('then at an error box');
  35.     button := form_error(1);            { error code is 1 }
  36.  
  37.     Message('Why don''t we center this box on the screen?');
  38.     form_center(GemInterface.MessageBox, x, y, w, h);
  39.     Inform('');                         { redraw frame rectangle }
  40.     Message('How about that!');
  41.  
  42.     Message('Now, we''ll redo this dialog with the help');
  43.     Message('of form_dial and form_do');
  44.     Message('This message will be redone!');
  45.  
  46.     { the OK button from the message box must be deselected before }
  47.     { we activate the dialog box again; otherwise it will be drawn }
  48.     { in a selected state. You can try to comment the following    }
  49.     { line out to see the difference :                             }
  50.     GemInterface.MessageBox^[OKBUTTON].ob_state := NORMAL;
  51.  
  52.     smallX := x + w div 2;      { set up small representation of }
  53.     smallY := y + h div 2;      { the message box                }
  54.     smallW := w div 2;
  55.     smallH := h div 2;
  56.  
  57.     { first, we reserve memory space for the image of the border }
  58.     { of the box : }
  59.     form_dial(FMD_START, 0, 0, 0, 0, x, y, w, h);
  60.  
  61.     { then we draw a growing rectangle (the one from the desktop) }
  62.     form_dial(FMD_GROW, smallX, smallY, smallW, smallH, x, y, w, h);
  63.  
  64.     { after that, we draw the dialog box on the screen }
  65.     objc_draw(GemInterface.MessageBox, FRAMEBOX, $7FFF, 0, 0, 0, 0);
  66.  
  67.     { so now we're ready to do the dialog }
  68.     graf_mouse(M_ON, NIL);
  69.     button := form_do(GemInterface.MessageBox, -1);
  70.     graf_mouse(M_OFF, NIL);
  71.  
  72.     { after that's completed, we draw the shrinking box }
  73.     form_dial(FMD_SHRINK, smallX, smallY, smallW, smallH, x, y, w, h);
  74.  
  75.     { and restore the border area image from memory }
  76.     form_dial(FMD_FINISH, 0, 0, 0, 0, x, y, w, h);
  77.  
  78.     Inform('');                         { redraw frame rectangle }
  79.     Message('That''s all folks!');
  80.     Exit_Gem
  81.   end
  82. end.
  83.