CREATE CHECKBOX Examples


Example 1:

 

*

 

 

.Define the CHECKBOX, BUTTON, and other variables

.

 

 

CHKBOX1

CHECKBOX

 

BUTTON1

BUTTON

 

RESULT

FORM

1

*

 

 

.Create the Objects

.

 

 

  

CREATE

CHKBOX1=4:5:21:37:

  

  

"Test Checkbox",STYLE=3DOUT

  

CREATE

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

*

 

 

.Activate the Objects

.

 

 

  

ACTIVATE

CHKBOX1 // Perform Default Action

  

ACTIVATE

BUTTON1,EXIT,RESULT

*

 

 

.Wait for an Event to Occur

.

 

 

  

LOOP

 

  

  EVENTWAIT

 

  

REPEAT

 

*

 

 

.Exit Button Selected - Display the Value of the CHECKBOX

.

 

 

EXIT

 

 

  

GETITEM

CHKBOX1,0,RESULT

  

DISPLAY

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

  

  

RESULT,*W3;

 

STOP

 

 

This example creates a CHECKBOX on the screen. During program execution, the box may be clicked to set or clear the check. This action is performed automatically by the runtime since no user provided routine was specified during the CHECKBOX activation. When the Exit BUTTON is clicked, the value of the CHECKBOX is displayed and the program terminates.

 

Example 2:

 

*

 

 

 

.Define the CHECKBOX, BUTTON, and other variables

.

 

 

 

CB1

CHECKBOX

 

 

BUTTON1

BUTTON

 

 

RESULT

INTEGER

1

 

VALUE

FORM

1

 

*

 

 

 

.Create the Objects

.

 

 

 

  

CREATE

CB1=3:4:35:50,"Check Me!"

  

CREATE

BUTTON1=6:7:35:42,"Exit"

*

 

 

 

.Activate the Objects

.

 

 

 

  

ACTIVATE

CB1,ROUTINE,RESULT

// Specifies User Routine

  

ACTIVATE

BUTTON1,EXIT,RESULT

 

*

 

 

 

.Wait for an Event to Occur

.

 

 

 

  

LOOP

 

 

  

  EVENTWAIT

 

 

  

REPEAT

 

 

*

 

 

 

.Check Box Clicked

.

 

 

 

ROUTINE

 

 

 

  

ALERT

NOTE,”Check Box Clicked!”,RESULT

.

 

 

 

  

GETITEM

CB1,0,RESULT

// Get the Current State

  

XOR

0x1,RESULT

// Toggle it

  

SETITEM

CB1,0,RESULT

// Update the object

  

RETURN

 

 

*

 

 

 

.Exit Button Selected - Retrieve and Display the Value of the Check Box

.

 

 

 

EXIT

 

 

 

  

GETITEM

CB1,0,VALUE

 

  

DISPLAY

*P10:10,"Value of the Check Box ":

  

  

  "object upon exit: ",VALUE,*W3;

  

STOP

 

 

 

This example creates a CHECKBOX and command BUTTON on the screen. During activation of the CHECKBOX button, a user-defined routine is provided. The user provided routine simply reports that the CHECKBOX has been clicked using an ALERT box and changes its state. Note that no automatic changing of the CHECKBOX state occurs by the runtime since user code was provided during the activation of the object.

 

 



PL/B Language Reference CREATE BUTTON Example CREATE CHECKGRP Example