home *** CD-ROM | disk | FTP | other *** search
/ DOS Wares / doswares.zip / doswares / DATABASE / DBASE5 / CUA_SAMP.ZIP / MENUWIN.PRG < prev    next >
Encoding:
Text File  |  1994-06-24  |  1.6 KB  |  50 lines

  1. ************************************************************
  2. * FILE MENUWIN.PRG
  3. * Shows how to use OnClick with pushbuttons and menu items.
  4. * Sample program for Chapter 22 of the "Programmer's Guide."
  5. ************************************************************ 
  6. DEFINE MENUBAR Main PROPERTY ColorMenubarNormal "B+/W"
  7.  
  8. DEFINE MENUITEM OpenWin OF Main ;
  9.    PROPERTY ;
  10.       Text "&Open Window", ;
  11.       OnClick WinOpen
  12.  
  13. DEFINE MENUITEM Exit OF Main ;
  14.    PROPERTY ;
  15.       Text "E&xit", ;
  16.       OnClick ExitAll
  17.    
  18. DEFINE FORM f1 AT 9,20 ;
  19.    PROPERTY ;
  20.       Text "Form window", Height 6, Width 40, ;
  21.       OnOpen FormOpen
  22.  
  23. DEFINE PUSHBUTTON pb1 OF f1 AT 1,1 ;
  24.    PROPERTY ;
  25.       Text "&Close window", Width 16, OnClick WinClose
  26.       
  27. DEFINE PUSHBUTTON pb2 OF f1 AT 1,19 ;
  28.    PROPERTY ;
  29.       Text "&Does nothing", Width 16
  30.  
  31. lVoid = Main.Open()
  32.  
  33. PROCEDURE WinOpen              && OnClick event handler for OpenWin menuitem
  34.    lVoid = f1.Open()           && Open the form window f1.
  35. RETURN            
  36.  
  37. PROCEDURE FormOpen             && OnOpen event handler for form window f1.
  38.    lVoid = f1.pb1.Setfocus()   && Force focus to the first pushbutton.
  39. RETURN
  40.  
  41. PROCEDURE WinClose             && OnClick event handler for pushbutton pb1.
  42.    lVoid = form.Close()        && Close form window f1.
  43. RETURN            
  44.  
  45. PROCEDURE ExitAll              && OnClick event handler for menu item Exit
  46.    lVoid = Main.Release()      && Release the menu bar.
  47.    lVoid = f1.Release()        && Release the form window.
  48.    RELEASE Main                && Remove the unused object reference 
  49.    RELEASE f1                  && variables from memory.
  50.