[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
+---------------------------------+
|             ON BAR              |
+---------------------------------+
ON BAR <expN> OF <popup name1>
        [ACTIVATE POPUP <popup name2>
        | ACTIVATE MENU <menu name>]

-----------------------------------
Activates popup or menu bar when popup option is chosen.
-----------------------------------

When an option is chosen from a menu popup, several events may occur -
another menu popup may be displayed and activated, a menu bar may be
displayed and activated or a routine may be executed.  The ON BAR
command lets you display and activate another menu popup or menu bar
when an option is chosen.  A popup that displays and activates another
popup or a menu bar is called a hierarchical popup.  To execute a
routine when an option is chosen you must use an ON SELECTION BAR or ON
SELECTION POPUP command.

<expN> OF <popup name1>
        Each option in a popup may have another popup or a menu bar assigned to
it.  Specify the option's BAR number <expN> and the name of the popup
<popup name1> containing the option, and the popup <popup name2> or menu
bar <menu name> to be displayed and activated.

        A popup option that has a popup or menu bar assigned to it will have an
arrow placed to the right of the option.  The arrow indicates that an
additional popup or menu bar is available for the option.  If an
option's popup was created with the MARGIN keyword, an additional space
for the hierarchical arrow is placed to the right of each option.  If an
option's popup was created without the MARGIN keyword, the hierarchical
arrow may overwrite the last character of the option.

ACTIVATE POPUP <popup name2>
 | ACTIVATE MENU <menu name>
        To release a menu popup or menu bar from an option, use ON BAR <expN>
OF <popup name1> without an ACTIVATE POPUP <popupname2> or ACTIVATE MENU
<menu name> clause.

+---------------------------------+
|         Program Example         |
+---------------------------------+
The example below demonstrates a system of hierarchical popups.  A menu
bar named DINNER is created with two menu bar pads.  Each pad has a
corresponding ON PAD that activates the MAINCOURSE or DESSERT popup. The
MAINCOURSE and DESSERT popups each have additional popups (BURGER, PIZZA
and PIE) assigned to some of their options with three ON BAR commands.
The OLIVE and PIE options have additional popups assigned to them
through 2 more ON BAR commands.

DEFINE WINDOW order FROM 10,0 TO 13,39

DEFINE MENU dinner
DEFINE PAD one OF dinner PROMPT '\<Main Course' KEY ALT+M, ''
DEFINE PAD two OF dinner PROMPT '\<Dessert'     KEY ALT+D, ''
ON PAD one OF dinner ACTIVATE POPUP maincourse
ON PAD two OF dinner ACTIVATE POPUP dessert

DEFINE POPUP maincourse MARGIN MESSAGE ;
        'We have burgers and pizza today'
DEFINE BAR 1 OF maincourse PROMPT '\<Hamburgers'
DEFINE BAR 2 OF maincourse PROMPT '\<Pizza'
ON BAR 1 OF maincourse ACTIVATE POPUP burger
ON BAR 2 OF maincourse ACTIVATE POPUP pizza

DEFINE POPUP burger MARGIN MESSAGE ;
        'What would you like on your burger?'
DEFINE BAR 1 OF burger PROMPT '\<Ketchup'
DEFINE BAR 2 OF burger PROMPT '\<Mustard'
DEFINE BAR 3 OF burger PROMPT '\<Onions'
DEFINE BAR 4 OF burger PROMPT '\<Pickles'

DEFINE POPUP pizza MARGIN MESSAGE ;
        'Here are the available toppings'
DEFINE BAR 1 OF pizza PROMPT '\<Anchovies'
DEFINE BAR 2 OF pizza PROMPT '\<Green Peppers'
DEFINE BAR 3 OF pizza PROMPT '\<Olives'
DEFINE BAR 4 OF pizza PROMPT '\<Pepperoni'
ON BAR 3 OF pizza ACTIVATE POPUP olives

DEFINE POPUP olives MARGIN
DEFINE BAR 1 OF olives PROMPT '\<Black' MESSAGE 'Black olives?'
DEFINE BAR 2 OF olives PROMPT '\<Green' MESSAGE 'Green olives?'

DEFINE POPUP dessert MARGIN MESSAGE 'Our dessert offerings'
DEFINE BAR 1 OF dessert PROMPT '\<Brownies'
DEFINE BAR 2 OF dessert PROMPT '\<Cookies'
DEFINE BAR 3 OF dessert PROMPT '\<Ice Cream'
DEFINE BAR 4 OF dessert PROMPT '\<Pie'
ON BAR 4 OF dessert ACTIVATE POPUP pie

DEFINE POPUP pie MARGIN MESSAGE 'What kind of pie?'
DEFINE BAR 1 OF pie PROMPT '\<Blueberry'
DEFINE BAR 2 OF pie PROMPT '\<Cherry'
DEFINE BAR 3 OF pie PROMPT '\<Peach'
DEFINE BAR 4 OF pie PROMPT '\<Rhubarb'

ON SELECTION POPUP ALL DO yourchoice

ACTIVATE MENU dinner

PROCEDURE yourchoice
ACTIVATE WINDOW order
CLEAR
DO CASE
        CASE POPUP() = 'BURGER'
                @ 0,0 SAY 'A ' + LOWER(POPUP()) + ' order:'
                @ 1,0 SAY 'You ordered a burger with ' + LOWER(PROMPT())
        CASE POPUP() = 'PIZZA'
                @ 0,0 SAY 'A ' + LOWER(POPUP()) + ' order:'
                @ 1,0 SAY 'You ordered a pizza with ' + LOWER(PROMPT())
        CASE POPUP() = 'OLIVES'
                @ 0,0 SAY 'A pizza order:'
                @ 1,0 SAY 'You ordered a pizza with ' ;
                        + LOWER(PROMPT()) + ' olives'
        CASE POPUP() = 'DESSERT'
                @ 0,0 SAY 'A ' + LOWER(POPUP()) + ' order:'
                @ 1,0 SAY 'You ordered ' + LOWER(PROMPT()) + ' for dessert'
        CASE POPUP() = 'PIE'
                @ 0,0 SAY 'A pie order:'
                @ 1,0 SAY 'You ordered ' + LOWER(PROMPT()) + ' pie'
ENDCASE
WAIT WINDOW
DEACTIVATE WINDOW order
RETURN

-----------------------------------

See Also:  ACTIVATE MENU, ACTIVATE POPUP, BAR(), DEFINE BAR, DEFINE
POPUP, ON SELECTION BAR, ON SELECTION POPUP, POPUP()

-----------------------------------

See Also: ACTIVATE MENU ACTIVATE POPUP BAR() DEFINE BAR DEFINE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson