Object Instructions


PLBCMP GUI Only

 

A number of object variables have been added to PL/B to support the Graphical User Interface. Accordingly, several new verbs have been added to manipulate these various objects.

 

ACTIVATE

Makes an object visible and allows the user to interact with it.

CHECKITEM

Set or clear a check mark beside a menu item.

CHECKPROP

Determine if a property is valid for an object.

CREATE

Creates all necessary data structures for an object.

DEACTIVATE

Hides the object from the user.

DELETEITEM

Delete an item from an object.

DESTROY

Release the data structures obtained for an object.

DISABLEITEM

Prevents user interaction.

DRAGITEM

Enable or disable an object's drag and drop capabilities.

ENABLEITEM

Allows user interaction.

EVENTREGISTER

Associates an event with a program execution label.

EVENTSEND

Sends an event to a specified object.

FORMLOAD

Load and activate a PLFORM.

GETFOCUS

Obtain the identification number of the object that currently has focus.

GETITEM

Obtain the value of an object item.

GETPROP

Obtain the value of a specific property.

INSERTITEM

Add a new item to an object.

LISTCNT

Count objects in a COLLECTION.

LISTDEL

Delete an object from a COLLECTION.

LISTGET

Retrieve an object from a COLLECTION.

LISTINS

Insert an object into a COLLECTION.

SETFOCUS

Changes the current focus.

SETITEM

Set the value of an object item.

SETPROP

Set the value of a specific property.

 

The following is the minimum number of instructions required for object variables:

 

 

CREATE

{object}...

;Allocates memory

 

...

 

 

 

ACTIVATE

{object}...

;Displays on screen

 

...

 

 

 

DEACTIVATE

{object}

;Takes off screen

 

...

 

 

 

DESTROY

{object}

;Deallocates memory

 

The other instructions change the state of an active object or to add or delete items in an object.

 

Following on the next page is a simple program to create a single button, a menu item and a submenu item. A check mark is placed beside the menu items when they are selected and the check mark is deleted when they are selected again.

 

*

 

 

. Sample PL/B program to demonstrate SUBMENU usage.

.

 

 

HALT

BUTTON

 

MENU1

MENU

 

MENUOPT

FORM

1(3)

SUBMNU

SUBMENU

 

SUBMNUD

INIT

"/SSubOptions;":

 

 

"/1Test1;":

 

 

"/2Test2;":

 

 

"/3Test3"

RESULT

FORM

2

INS

INTEGER

1,"1"

*

 

 

. Initialize the Window

.

 

 

 

DISPLAY

*BGCOLOR=*CYAN,*FGCOLOR=*BLACK:

 

 

*ES,*P33:1,*BLACK,"SubMenu Test"

*

 

 

. Create HALT button selection to Exit in a nice mode.

.

 

 

 

CREATE

HALT=9:10:35:45,"HALT"

 

ACTIVATE

HALT,EXIT,RESULT

*

 

 

. Create a MENU item named "Menu".

.

 

 

 

CREATE

MENU1,"/OOptions;/DDisplay;/LList;/NNone"

 

ACTIVATE

MENU1,MENUEXC,RESULT

*

 

 

. Create SUBMENU

.

 

 

 

CREATE

SUBMNU,SUBMNUD,MENU1,2

 

ACTIVATE

SUBMNU,SUBEXC,RESULT

*

 

 

. This is the primary event processing point.

.

 

 

 

LOOP

 

 

EVENTWAIT

 

 

REPEAT

 

*

 

 

. Exit Point. This routine is called when

. the STOP button is clicked on.

.

 

 

EXIT

STOP

 

*

 

 

. MENU1 items processed. Toggle check mark

. beside menu item selected.

.

 

 

MENUEXC

 

 

 

IF

( MENUOPT(RESULT) = 1 )

 

CHECKITEM

MENU1,RESULT,OFF

 

CLEAR

MENUOPT(RESULT)

 

ELSE

 

 

CHECKITEM

MENU1,RESULT,ON

 

MOVE

"1",MENUOPT(RESULT)

 

ENDIF

 

 

RETURN

 

*

 

 

. SUBMNU items processed.

.

 

 

SUBEXC

 

 

 

...

 

 

RETURN

 

 

 



PL/B Language Reference ACTIVATE