Progress
Programming
Handbook


Static Pop-up Menus

You set up a static pop-up menu by using the DEFINE MENU statement. By default, if you don’t specify the MENUBAR phrase, Progress treats this widget as a pop-up menu. To associate a pop-up menu with a widget, you assign the handle of the menu to the widget’s POPUP–MENU attribute.

The p-popup.p procedure displays a button that has an associated pop-up menu:

p-popup.p 
DEFINE BUTTON hi     LABEL "Hello".

DEFINE MENU popmenu TITLE "Button State"
   MENU-ITEM ve      LABEL "Hello"
   MENU-ITEM vd      LABEL "Howdy"
   MENU-ITEM iv      LABEL "Hey"
   RULE
   MENU-ITEM ep      LABEL "Exclamation point" TOGGLE-BOX
   RULE
   MENU-ITEM ex      LABEL "Exit".

FORM
   hi  AT ROW 4 COLUMN 5
     WITH FRAME button-frame. 

/* Set popmenu to be the pop-up menu for hi. */   
ASSIGN hi:POPUP-MENU = MENU popmenu:HANDLE.

/* Define action for menu selections. */
ON CHOOSE OF MENU-ITEM ve, MENU-ITEM vd, MENU-ITEM iv
   ASSIGN hi:LABEL IN FRAME button-frame = SELF:LABEL.

/* Define action for button selection. When the button is
   selected, display the current button label as a message.
   If Exclamation Point is checked, add an exclamation point
   to the message; otherwise, add a period.                  */
ON CHOOSE OF hi
   MESSAGE hi:LABEL IN FRAME button-frame +
           (IF MENU-ITEM ep:CHECKED IN MENU popmenu THEN "!" ELSE ".").
 
/* Enable input on the button and wait for the
   user to select Exit from menu.              */
ENABLE hi WITH FRAME button-frame.

WAIT-FOR CHOOSE OF MENU-ITEM ex. 

When you run this code, a button with a label Hello appears on the screen. When you pop up the associated menu and choose any of the first three menu items—Hello, Howdy, or Hey—the label of the button changes accordingly to the value of the chosen item. Subsequently, when you choose the button itself, the current value of the button’s label displays as a message at the bottom of the window. The message ends in either a period or an exclamation point, depending on the current state of the ep toggle-box menu item. See the "Menu Toggle Boxes" section for more information.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095