Kbase P1260: 4GL. How to Enable or Disable Menu-Items programatically?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/8/2007 |
|
Status: Unverified
GOAL:
How to Enable or Disable Menu-Items programmatically?
GOAL:
How to Enable Menu-Items programmatically
GOAL:
How to Disable Menu-Items programmatically
GOAL:
How to Enable Pop-up menus
GOAL:
How to Disable Pop-up menus
FACT(s) (Environment):
Progress Version 9.1x
OpenEdge 10.x
FIX:
Use the SENSITIVE attribute as follow:
MENU popup-menu-button-1:SENSITIVE = NO. (disable)
MENU popup-menu-button-1:SENSITIVE = YES. (enable)
The code below illustrate how to ENABLE or DISABLE Menu-Items.
DEFINE VARIABLE mywin AS WIDGET-HANDLE.
DEFINE SUB-MENU myfile
MENU-ITEM m1 LABEL "Save"
MENU-ITEM m2 LABEL "Save As"
MENU-ITEM m3 LABEL "Exit".
DEFINE SUB-MENU myobjects
MENU-ITEM m1 LABEL "Circle"
MENU-ITEM m2 LABEL "Line"
MENU-ITEM m3 LABEL "Rectangle"
MENU-ITEM m4 LABEL "Text".
DEFINE SUB-MENU myedit
SUB-MENU myobjects LABEL "Add"
MENU-ITEM e1 LABEL "Delete"
MENU-ITEM e2 LABEL "Copy".
DEFINE MENU mybar MENUBAR
SUB-MENU myfile LABEL "File"
SUB-MENU myedit LABEL "Edit".
CREATE WINDOW mywin
ASSIGN MENUBAR = MENU mybar:HANDLE.
DEFINE BUTTON b1 LABEL "Text Mode".
DEFINE BUTTON b2 LABEL "Graphics Mode".
CURRENT-WINDOW = mywin.
FORM
b1 at X 10 Y 120
b2 at x 120 Y 120
WITH FRAME x.
ENABLE b1 b2 WITH FRAME x.
ON CHOOSE OF b1 IN FRAME x DO:
MENU-ITEM m1:SENSITIVE IN MENU myobjects = NO.
MENU-ITEM m2:SENSITIVE IN MENU myobjects = NO.
MENU-ITEM m3:SENSITIVE IN MENU myobjects = NO.
MENU-ITEM m4:SENSITIVE IN MENU myobjects = YES.
END.
ON CHOOSE OF b2 IN FRAME x DO:
MENU-ITEM m1:SENSITIVE IN MENU myobjects = YES.
MENU-ITEM m2:SENSITIVE IN MENU myobjects = YES.
MENU-ITEM m3:SENSITIVE IN MENU myobjects = YES.
MENU-ITEM m4:SENSITIVE IN MENU myobjects = NO.
END.
WAIT-FOR CHOOSE OF MENU-ITEM m3 IN MENU myfile.
DELETE WIDGET mywin.