home *** CD-ROM | disk | FTP | other *** search
- The OMENU System
- Copyright (c) 1990 Nantucket Corp. All rights reserved.
-
-
- The OMENU system is a SAA/CUA-compatible menu system designed to
- simulate an event-driven architecture in Clipper. It can be used
- as most Clipper menus are used currently: select an item,
- execute an action, return to menu, and repeat. An example of
- using the menu system in this manner is seen in Odemo1.prg. The
- menu system can also be used in a more SAA style format. That
- is, the menu is always accessible regardless of what the user is
- currently doing. This allows the user to move from process to
- process or to change some attribute of the current process all
- via the OMENU system. For example, you could define menu items
- so the user can change settings such as CONFIRM or BELL during a
- READ, or jump from browsing a database file directly to printing
- a report. An example of this more involved usage can be seen in
- Odemo2.prg
-
- The OMENU system is completely dynamic, allowing you to change
- various attributes of the menu system throughout your
- application. This requires some extra work, since you are
- required to disable (gray) those items you do not want selectable
- at certain times. As an example, an active "Save" menu item does
- not make sense if there are no files open. The other
- responsibility is that you must re-enable the disabled menu items
- when you want to make then available once again. This facility
- is also demonstrated in Odemo2.prg
-
-
- Creating Menus
-
- Menus are created as follows:
-
- 1. Create an empty menubar
- 2. Create an empty menu for each option you want on the menubar
- 3. Create an empty menu for each submenu you want on a menu
- 4. Add prompts and submenus to each menu
- 5. Add menus to the menubar
- 6. Add "quick keys" or "shortcut keys" to menubar
-
- Prompts that are added to the menu are required to have an unique
- numeric ID number that is used to check for the item being
- selected. These are best implemented by creating a header file
- for you application that contains manifest constants (#defines)
- for each option, so that the number does not have to be
- remembered.
-
-
- Activating Menus
-
- Once the menubar and the menus are created, the menu system is
- activated in several ways:
-
- 1. Through BarActivate() when you want the menu to have
- complete control (rare).
-
- 2. Through BarInstall() in conjunction with PostExitBlock()
- when used combination with a READ.
-
- 3. Through the DBEDIT() or MEMOEDIT() user function. In this
- case, BarActivate() is called with the keystroke passed to
- select a menu items and PostExitBlock() is used to post the
- code to terminate the menu system as well as DBEDIT() or
- MEMOEDIT().
-
- NOTE: Non-interruptible tasks should not be able to call the menu
- system during operation.
-
- NOTE: There are examples of points 1 and 2 above in Odemo2.prg.
-
- In all cases, the menubar will be visible but inactive until the
- user presses F10 or one of the Alt keys to activate a specific
- menu.
-
-
- Selecting Menu Items
-
- The menubar retains the last prompt selected. This value
- retrieved by you using the BarMenuChoice() function. If the
- prompt was a "toggle" prompt, or a prompt with an action
- codeblock associated with it, BarMenuChoice() will never equal to
- their IDs because those options do not change the "last choice"
- setting. Any other prompt executes the "exit block" posted with
- PostExitBlock() and expects it to end the current function so
- control returns to a point where the item selected can be
- executed. Odemo2.prg demonstrates this behavior.
-