Syntax
NumButtons( ) --> nButtonCountArguments
None.
Return value
The number of buttons the GT reports, 0 without a mouse.
Description
NumButtons() asks the GT, for example before the program offers an action on the right button.
Notes
NumButtons() needs a GT.
Example
#if OS_LINUX
REQUEST GTXWC
#else
REQUEST GTWVT
#endif
PROCEDURE Main()
LOCAL nButtons := NumButtons()
Check( 'NumButtons() is a number ', ValType( nButtons ), "N" )
Check( 'NumButtons() is not negative ', nButtons >= 0, .T. )
QOut( "" )
QOut( "The mouse has " + LTrim( Str( nButtons ) ) + " buttons" )
QOut( "Any key or 10 seconds ends the program" )
Inkey( 10 )
RETURN
STATIC PROCEDURE Check( cTitle, xResult, xExpected )
QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )
RETURNOutput
NumButtons() is a number OK
NumButtons() is not negative OK