38
Format 7: Logical Push, Release
BUTTON {ON | OFF} [*]ctl_id[,ERR=stmtref]
Use BUTTON ON/OFF to make it look like the button was pressed/released though
no signal is generated; e.g.,
0030 BUTTON ON 4000
Format 8: Read Activation Mode
BUTTON READ [*]ctl_id,mode$[,ERR=stmtref]
Use BUTTON READ to receive the user's method of selecting the button. ProvideX
returns a hex value in the mode$ variable to tell you what keystroke last activated the
button. Once read, this field is reset to $00$. Possible values are described below:
$01$ for MOUSE-CLICK.
$02$ for DOUBLE MOUSE-CLICK.
$0D$ for Enter .
$20$ for SPACEBAR (and keyboard hot key, as in the example below).
$09$ for Tab to go to the button.
$00$ when the user exits the button control.
Other specific characters include: $81$ for F1 $82$ for F2 ...
Read the user's selection(s) to make them available to your applications. In the
example below, the STROKE$ variable returns the user's method of selection (by
mouse, carriage return or space bar). The value returned for keyboard strokes (the
hot key Alt -B and the SPACEBAR for the following example, is $20$).
0010
! BUTTON Example
0020
PRINT 'CS'
0030
LIST
0040
BUTTON 2000,@(24,17,7,3)="{!BUG|!STOP}Hit the &Bug"
0050
LET BTN=2000
0060
SETCTL BTN:READ_BOX
0070
BUTTON GOTO BTN
0080
PRINT @(24,24),"HotKey=<Alt-B>. Try Mouse and keyboard too. END=<F4>"
0090
OBTAIN (0,SIZ=1,ERR=0090)@(0,0),'CURSOR'("off"),'ME',IN_VAR$,'MN'
0100
IF CTL=4 THEN GOTO END
0110
READ_BOX:
0120
BUTTON READ BTN,STROKE$
0130
PRINT @(24,20),"Your HTA(selection)=",HTA(STROKE$),",CTL=",CTL:"#####"
0150
GOTO 0090
0160
END:
0170
BUTTON REMOVE BTN; PRINT 'CS'
See Also