CREATE DATALIST Example


Example:

 

*

 

 

.Define the DATALIST, BUTTON, and other variables

.

 

 

DLIST1

DATALIST

 

BUTTON1

BUTTON

 

RESULT

FORM

2

DLVAL

FORM

1

*

 

 

.Create the Objects

.

 

 

  

CREATE

DLIST1=6:12:32:48,STYLE=3DOUT

  

CREATE

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

*

 

 

.Insert Items into the DATALIST

.

 

 

  

INSERTITEM

DLIST1,0,"Ash"

  

INSERTITEM

DLIST1,1,"Elm"

  

INSERTITEM

DLIST1,2,"Oak"

  

INSERTITEM

DLIST1,3,"Pemay"

  

INSERTITEM

DLIST1,4,"Walnut"

.

 

 

  

INSERTITEM

DLIST1,2,"Hickory"

  

INSERTITEM

DLIST1,3,"Maple"

*

 

 

.Activate the Objects

.

 

 

  

ACTIVATE

DLIST1

  

ACTIVATE

BUTTON1,EXIT,RESULT

*

 

 

.Wait for an Event to Occur

.

 

 

  

LOOP

 

  

  EVENTWAIT

 

  

REPEAT

 

*

 

 

.Exit Button Selected - Display the Value of the DATALIST

.

 

 

EXIT

 

 

  

GETITEM

DLIST1,0,DLVAL

  

DISPLAY

*P10:14,"Value of the DATALIST upon exit: ":

  

  

DLVAL, *W3;

  

STOP

 

 

This example creates a DATALIST object. Four (4) items are added to the object in order. Two (2) items are added between existing items. 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 CONTROL Example CREATE DIALOG Example