CREATE COLOR Examples


Example 1:

 

COLOR1

COLOR

 

  

...

 

  

CREATE

COLOR1=48:10:25

 

This instruction creates a COLOR object that has a red component of 48, a green component of 10 and a blue component of 25

 

Example 2:

 

COLOR1

COLOR

 

  

...

 

  

CREATE

COLOR1=*BLUE

 

This instruction creates a COLOR object that is BLUE.

 

Example 3:

 

*

 

 

.Define the COLOR, BUTTON, and other variables

.

 

 

COLOR1

COLOR

 

BUTTON1

BUTTON

 

RESULT

FORM

2

.

 

 

CVALUE

FORM

8 //twenty-four bit Color Value

RVALUE

FORM

3 //Red Color Value

GVALUE

FORM

3 //Green Color Value

BVALUE

FORM

3 //Blue Color Value

*

 

 

.Allow the User to Select a Color

.

 

 

  

CREATE

COLOR1

*

 

 

.Retrieve the Selected Color Values

.

 

 

  

GETITEM

COLOR1,0,CVALUE

  

GETITEM

COLOR1,1,RVALUE

  

GETITEM

COLOR1,2,GVALUE

  

GETITEM

COLOR1,3,BVALUE

*

 

 

.Display the Selected Color Values

.

 

 

  

DISPLAY

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

  

  

  *P15:11,"twenty-four bit Color Value: ", CVALUE:

  

  

  *P24:12,"Red Value: ",RVALUE:

  

  

  *P22:13,"Green Value: ",GVALUE:

  

  

  *P23:14,"Blue Value: ",BVALUE;

*

 

 

.Create and Activate an Exit Button

.

 

 

  

CREATE

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

  

ACTIVATE

BUTTON1,EXIT,RESULT

*

 

 

.Wait for an Event to Occur

.

 

 

  

LOOP

 

  

 EVENTWAIT

 

  

REPEAT

 

*

 

 

.Exit Button Selected

.

 

 

EXIT

 

 

  

STOP

 

 

This example opens a COLOR dialog. Upon selecting a color, the twenty-four bit value is displayed along with the red, green and blue values. When the Exit BUTTON is clicked, the program terminates.

 

 



PL/B Language Reference CREATE CHECKGRP Example CREATE COMBOBOX Example