CREATE COMBOBOX Example


Example:

 

*

 

 

.Define the COMBOBOX, BUTTON and other variables

.

 

 

COMBO1

COMBOBOX

 

COMBOD

INIT

";N)one;)Display;)Printer;)File"

BUTTON1

BUTTON

 

RESULT

FORM

2

CBVAL

FORM

1

*

 

 

.Create the Objects

.

 

 

  

CREATE

COMBO1=6:12:16:45,"Output: ",COMBOD,STYLE=3DOUT

  

CREATE

BUTTON1=16:17:35:42,"Exit"

*

 

 

.Activate the Objects

.

 

 

  

ACTIVATE

COMBO1

  

ACTIVATE

BUTTON1,EXIT,RESULT

*

 

 

.Wait for an Event to Occur

.

 

 

  

LOOP

 

  

  EVENTWAIT

 

  

REPEAT

 

*

 

 

.Exit Button Selected - Display the Value of the COMBOBOX

.

 

 

EXIT

 

 

  

GETITEM

COMBO1,0,CBVAL

  

DISPLAY

*P10:10,"Value of the COMBOBOX upon exit: ":

  

  

CBVAL, *W3;

  

STOP

 

 

This example creates a COMBOBOX with a title of 'Output" and four (4) menu selections. During program execution, the user may select any item from the box. When the Exit BUTTON is clicked, the value of the selected item number is displayed and the program terminates.

 

 



PL/B Language Reference CREATE COLOR Examples CREATE CONTAINER Example