CREATE MENU Example


Example:

 

*

 

 

.Define the Replacement File Menu

.

 

 

FILEMENU

MENU

 

FILEITEM

INIT

")File?1001;Print )Setup?1002;)Print;E)xit?1003"

*

 

 

.Define a New Options Menu

.

 

 

OPTSMENU

MENU

 

OPTSITEM

INIT

")Options;Option )1;-;Option )2;Option )3"

*

 

 

.Define a New Menu with Standard Edit Menu Functionality

.

 

 

NEDITMENU

MENU

 

NEDITITEM

INIT

")New Edit;)Undo<1;":

 

  

"Cu)t",0x9,"Ctrl+X<2;":

 

  

")Copy",0x9,"Ctrl+C<3;":

 

  

")Paste",0x9,"Ctrl+V<4"

*

 

 

.Define the Quit Button and result variable

.

 

 

BUTTON1

BUTTON

 

RESULT

FORM

9

*

 

 

.Create the Objects

.

 

 

  

CREATE

FILEMENU,FILEITEM

  

CREATE

OPTSMENU,OPTSITEM

  

CREATE

NEDITMENU,NEDITITEM

.

 

 

  

CREATE

BUTTON1=20:21:35:42,"Quit"

*

 

 

.Activate the Objects

.

 

 

  

ACTIVATE

FILEMENU,FILEX,RESULT

  

ACTIVATE

OPTSMENU,OPTSX,RESULT

  

ACTIVATE

NEDITMENU

  

ACTIVATE

BUTTON1,QUIT,RESULT

*

 

 

.Wait for an Event to Occur

.

 

 

  

LOOP

 

  

  EVENTWAIT

 

  

REPEAT

 

*

 

 

.File Menu Item Selected

.

 

 

FILEX

 

 

  

DISPLAY

*P1:10,*EL,"File Menu - Item: ",RESULT;

  

RETURN

 

*

 

 

.Options Menu Item Selected

.

 

 

OPTSX

 

 

  

DISPLAY

*P1:10,*EL,"Options Menu - Item:",RESULT

  

RETURN

 

*

 

 

.Terminate the Program

.

 

 

QUIT

 

 

  

STOP

 

 

 

This instruction creates a replacement File menu and a new Options menu. The File menu has three entries: Print Setup, Printer, and Exit. The Options menu also has three entries: Option 1, Option 2 and Option 3. As items are selected, the appropriate routine is called the selected item number is displayed. Note that the separator bar in the Options menu causes Option 2 to report a value of "3" and Option 3 to report a value of "4". Additionally, the menu items may be selected using an Alt Keyboard Sequence. Selecting the Quit button terminates the program. The file menu data shows use of the help ID sequence.

 

 



PL/B Language Reference CREATE LISTVIEW Example CREATE MOVIE Example