GETBAR( ) Function Example

The following example creates a menu named popDemo. The MOVER keyword is included so the items in the menu can be rearranged. For information about rearranging menu items, see the MOVER clause in DEFINE POPUP.

The menu is activated, and a series of GETBAR( ) functions are used in PRMBAR( ) to return captions of each item. After you rearrange the items, press CTRL+Z to display the new item order.

CLEAR
ON KEY LABEL CTRL+Z DO showorder
WAIT WINDOW "Press CTRL+Z to refresh." NOWAIT

DEFINE POPUP popDemo MOVER FROM 2,2
DEFINE BAR 1 OF popDemo PROMPT 'One'
DEFINE BAR 2 OF popDemo PROMPT 'Two'
DEFINE BAR 3 OF popDemo PROMPT 'Three'
DEFINE BAR 4 OF popDemo PROMPT 'Four'

DO showorder
ACTIVATE POPUP popDemo

PROCEDURE showorder
CLEAR
@ 3,12 SAY  '1 ' + PRMBAR('popDemo', GETBAR('popDemo',1))
@ 4,12 SAY  '2 ' + PRMBAR('popDemo', GETBAR('popDemo',2))
@ 5,12 SAY  '3 ' + PRMBAR('popDemo', GETBAR('popDemo',3))
@ 6,12 SAY  '4 ' + PRMBAR('popDemo', GETBAR('popDemo',4))
RETURN