CREATE ICON Examples


Example 1:

 

*

 

 

.Define the ICON, Icon Number and a BUTTON

.

 

 

ICON1

ICON

 

ICONID

FORM

"10131"

BUTTON1

BUTTON

 

RESULT

INTEGER

1

*

 

 

.Create the Objects

.

 

 

  

CREATE

ICON1=12:30,ICONID

  

CREATE

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

*

 

 

.Activate the Objects

.

 

 

  

ACTIVATE

ICON1

  

ACTIVATE

BUTTON1,QUIT,RESULT

*

 

 

.Wait for an Event

.

 

 

  

LOOP

 

  

  EVENTWAIT

 

  

REPEAT

 

*

 

 

.Terminate

.

 

 

QUIT

 

 

  

STOP

 

 

This instruction creates the ICON object from the resource number 10131. Upon clicking the EXIT BUTTON, the program terminates.

 

Example 2:

ANS

DIM

1

ICON1

ICON

           // Icon Object

ICONID

FORM

6 // Resource Number

RESNAME

DIM

15 // Resource File Name

*

 

 

.Get the Resource File Name and Open It

.

 

 

  

TRAP

END IF ESC

.

 

 

  

TRAP

NORESLIB IF OBJECT

  

KEYIN

*P1:1,"Resource Name: ",RESNAME

  

SETMODE

*RESLIB=RESNAME

*

 

 

.Loop Through the Resource Numbers

.

 

 

LOOP

 

 

  

ADD

"1",ICONID

  

DISPLAY

*P1:12,ICONID;

*

 

 

.Attempt to Load the Bitmap

.

 

 

  

TRAP

NONE IF OBJECT

  

CREATE

ICON1=3:10:3:10,ICONID

  

ACTIVATE

ICON1

*

 

 

.Load Successful - Pause

.

 

 

 

KEYIN

ANS;

 

GOTO

LOOP

*

 

 

.Terminate

.

 

 

END

 

 

  

STOP

 

*

 

 

.No Bitmap Found

.

 

 

NONE

 

 

  

NORETURN

 

  

KEYIN

*T0,ANS;

  

GOTO

NXT

*

 

 

.Specified File Doesn’t Exist

.

 

 

NORESLIB

 

 

  

KEYIN

*P25:1,"Unable to Locate ":

  

  

"Specified File. “,ANS;

  

STOP

 

 

This example program will locate and display all bitmaps available in a user specified file.

 

 



PL/B Language Reference CREATE HSCROLLBAR Example CREATE LABELTEXT Example