INJECT Mnemonic - Set Button Response Text

Syntax

'INJECT' (id,text)

Description

The 'INJECT' mnemonic associates a string with a 'BUTTON' or 'TBUTTON' control. When that button is pushed, the text will be injected into the console typeahead buffer, where it can be read with a subsequent INPUT or READ command.

Parameter

Description

id

Control ID number. It must correspond to a 'BUTTON' or 'TBUTTON' control in the current context.

text

Text to be injected into the console typeahead buffer when this button is pushed.

Example

sysgui=unt
open(sysgui)"X0"

rem ' Create a GUI window
print (sysgui)'window'(100,100,200,200,"Inject",$0083$,$$)

rem ' Place a button control on the window
print (sysgui)'button'(101,50,50,60,20,"Inject",$$)

rem ' Define the text to be injected into the typeahead buffer
rem ' each time this button is clicked.
print (sysgui)'inject'(101,"sample")

rem ' Each time the button is clicked, text will appear in the
rem ' typeahead buffer. Print it and loop until the user ends
rem ' the program by pressing Ctrl+C in the console window or
rem ' Ctrl+BREAK in the GUI window.
while 1
    input text$
    print text$
wend

See Also

Mnemonics - Alphabetical Listing

Mnemonics - Group Listing