CLIPSET Example


Example:

 

*

 

 

.Include Standard Equates

.

 

 

  

INCLUDE

PLBEQU.INC

.

 

 

.$CENTER

EQU

1

.$LEFT

EQU

2

.$RIGHT

EQU

3

*

 

 

.Define the Objects Needed

.

 

 

ExitButton

Button

 

GetButton

Button

 

SetButton

Button

 

GetData

EditText

 

SetData

EditText

 

Color1

Color

 

ST

StatText

(3)

*

 

 

.Define the Data Items

.

 

 

Data

Dim

40

Length

Form

2

Result

Integer

1

*

 

 

.Create the labels

.

 

 

  

CREATE

Color1=*LTGRAY

  

CREATE

ST(1)=1:2:20:40,"CLIPGET/CLIPSET Test":

  

  

"'>MS Sans Serif'(10,BOLD)"

  

CREATE

ST(2)=10:11:1:29,"Text to Save to the Clipboard:":

  

  

"'>MS Sans Serif'(10)":

  

  

ALIGNMENT=$RIGHT

  

CREATE

ST(3)=13:14:1:29,"Text retrieved from the Clipboard:":

  

  

"'>MS Sans Serif'(10)":

  

  

ALIGNMENT=$RIGHT

*

 

 

.Create the Edittext objects

.

 

 

  

CREATE

SetData=10:11:31:65,BGCOLOR=Color1

  

CREATE

GetData=13:14:31:65,Static

*

 

 

.Create the Buttons

.

 

 

  

CREATE

GetButton=13:14:68:75,"&Get",Enabled=0

  

CREATE

SetButton=10:11:68:75,"&Set"

  

CREATE

ExitButton=20:21:40:47,"E&xit"

*

 

 

.Activate the objects

.

 

 

  

ACTIVATE

ST

.

 

 

  

ACTIVATE

SetButton,SetButtonR,Result

  

ACTIVATE

GetButton,GetButtonR,Result

  

ACTIVATE

ExitButton,ExitButtonR,Result

.

 

 

  

ACTIVATE

SetData,SetDataR,Result

  

ACTIVATE

GetData

.

 

 

  

SETFOCUS

SetData

*

 

 

.Wait for an Event to Occur

.

 

 

  

LOOP

 

  

WAITEVENT

 

  

REPEAT

 

*

 

 

.Exit Button Clicked

.

 

 

ExitButtonR

  

STOP

 

*

 

 

.Set Button Clicked

.

 

 

SetButtonR

  

GETITEM

SetData,0,Data

  

CLIPSET

Data

  

ENABLEITEM

GetButton

  

RETURN

 

*

 

 

.Get Button Clicked

.

 

 

GetButtonR

 

 

  

CLIPGET

Data

  

SETITEM

GetData,0,Data

  

RETURN

 

*

 

 

.Set Data Changed

.

 

 

SetDataR

 

 

  

GETITEM

SetData,0,Data

  

COUNT

Length,Data

  

IF

ZERO

  

DISABLEITEM

SetButton

  

ELSE

 

  

ENABLEITEM

SetButton

  

ENDIF

 

  

RETURN

 

 

The example above demonstrates the use of the CLIPSET and CLIPGET instructions. When the program is executed, a screen is displayed containing two EDITTEXT fields and three buttons. Data entered into the first field may be saved to the clipboard by clicking the Set button. Once saved, the data may be retrieved to the second EDITTEXT field by clicking the Get button. Clicking the Exit button terminates the program.

 

 



PL/B Language Reference CLEAREVENT Example CLOCK Examples