CREATE PICT Examples


Example 1:

 

*

 

 

.Define the PICT, BUTTON and other variables

.

 

 

PICT1

PICT

 

BUTTON1

BUTTON

 

RESULT

FORM

2

*

 

 

.Create the Objects

.

 

 

  

CREATE

PICT1=3:13:30:50:

  

  

  "C:\SUNBELT\DEMO\GIRL2.PCX",BORDER

  

CREATE

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

*

 

 

.Activate the Objects

.

 

 

  

ACTIVATE

PICT1

  

ACTIVATE

BUTTON1,EXIT,RESULT

*

 

 

.Wait for an Event to Occur

.

 

 

  

LOOP

 

  

  EVENTWAIT

 

  

REPEAT

 

*

 

 

.Exit Button Selected

.

 

 

EXIT

 

 

  

STOP

 

 

This example creates a PICT object using the file specified. When the Exit BUTTON is clicked, the program terminates.

 

Example 2:

 

ANS

DIM

1 // Response Variable

PIC1

PICT

          // Picture Object

PICID

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",PICID

  

DISPLAY

*P1:12,PICID;

*

 

 

.Attempt to Load the Bitmap

.

 

 

  

TRAP

NONE IF OBJECT

  

CREATE

PIC1=3:10:3:10,PICID

  

ACTIVATE

PIC1

*

 

 

.Load Successful - Pause

.

 

 

  

KEYIN

ANS;

  

GOTO

LOOP

*

 

 

.Terminate

.

 

 

END

 

 

  

STOP

 

*

 

 

.No Bitmap Found

.

 

 

NONE

 

 

  

NORETURN

 

  

KEYIN

*T0,ANS;

  

GOTO

LOOP

*

 

 

.Specified File Doesn’t Exist

.

 

 

NORESLIB

 

 

  

KEYIN

*P25:1,"Unable to Open ":

  

  

"Specified File. ",ANS

  

STOP

 

 

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

 

 



PL/B Language Reference CREATE PANEL Example CREATE POPUPMENU Example