home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a009 / 6.ddi / SAMPLE.LIF / OMENU.DOC < prev    next >
Encoding:
Text File  |  1991-04-14  |  3.5 KB  |  89 lines

  1. The OMENU System
  2. Copyright (c) 1990 Nantucket Corp.  All rights reserved.
  3.  
  4.  
  5. The OMENU system is a SAA/CUA-compatible menu system designed to
  6. simulate an event-driven architecture in Clipper.  It can be used
  7. as most Clipper menus are used currently:  select an item,
  8. execute an action, return to menu, and repeat.  An example of
  9. using the menu system in this manner is seen in Odemo1.prg.  The
  10. menu system can also be used in a more SAA style format.  That
  11. is, the menu is always accessible regardless of what the user is
  12. currently doing.   This allows the user to move from process to
  13. process or to change some attribute of the current process all
  14. via the OMENU system.  For example, you could define menu items
  15. so the user can change settings such as CONFIRM or BELL during a
  16. READ, or jump from browsing a database file directly to printing
  17. a report.  An example of this more involved usage can be seen in
  18. Odemo2.prg
  19.  
  20. The OMENU system is completely dynamic, allowing you to change
  21. various  attributes of the menu system throughout your
  22. application.  This requires some extra work, since you are
  23. required to disable (gray) those items you do not want selectable
  24. at certain times.  As an example, an active "Save" menu item does
  25. not make sense if there are no files open.  The other
  26. responsibility is that you must re-enable the disabled menu items
  27. when you want to make then available once again.  This facility
  28. is also demonstrated in Odemo2.prg
  29.  
  30.  
  31. Creating Menus
  32.  
  33. Menus are created as follows:
  34.   
  35.   1. Create an empty menubar
  36.   2. Create an empty menu for each option you want on the menubar
  37.   3. Create an empty menu for each submenu you want on a menu
  38.   4. Add prompts and submenus to each menu
  39.   5. Add menus to the menubar
  40.   6. Add "quick keys" or "shortcut keys" to menubar
  41.  
  42. Prompts that are added to the menu are required to have an unique
  43. numeric ID number that is used to check for the item being
  44. selected.  These are best implemented by creating a header file
  45. for you application that  contains manifest constants (#defines)
  46. for each option, so that the number does not have to be
  47. remembered.
  48.  
  49.  
  50. Activating Menus
  51.  
  52. Once the menubar and the menus are created, the menu system is
  53. activated in several ways:
  54.  
  55. 1.   Through BarActivate() when you want the menu to have
  56.      complete control (rare).
  57.  
  58. 2.   Through BarInstall() in conjunction with PostExitBlock()
  59.      when used combination with a READ.
  60.  
  61. 3.   Through the DBEDIT() or MEMOEDIT() user function.   In this
  62.      case, BarActivate() is called with the keystroke passed to
  63.      select a menu items and PostExitBlock() is used to post the
  64.      code to terminate the menu system as well as DBEDIT() or
  65.      MEMOEDIT().
  66.  
  67. NOTE: Non-interruptible tasks should not be able to call the menu
  68. system during operation.
  69.  
  70. NOTE: There are examples of points 1 and 2 above in Odemo2.prg.
  71.  
  72. In all cases, the menubar will be visible but inactive until the
  73. user presses F10 or one of the Alt keys to activate a specific
  74. menu.
  75.  
  76.  
  77. Selecting Menu Items
  78.  
  79. The menubar retains the last prompt selected.  This value
  80. retrieved by you using the BarMenuChoice() function.  If the
  81. prompt was a "toggle" prompt, or a prompt with an action
  82. codeblock associated with it, BarMenuChoice() will never equal to
  83. their IDs because those options do not change the "last choice"
  84. setting.  Any other prompt executes the "exit block" posted with
  85. PostExitBlock() and expects it to end the current function so
  86. control returns to a point where the item selected can be
  87. executed.  Odemo2.prg demonstrates this behavior.
  88.  
  89.