G4P ToggleButton (change state)

Hello,
is it possible to change the state of “G4P ToggleButton” other than with the mouse?
(For example by receiving information from the serial port.)
image

Thank you

You can change the state of a GimageToggleButton with the statement
button.setState(ns);

where ns is the new state number. If the button has 2 states then use ns = 0 or 1

In general if the button has nbrStates then ns can be in the range 1 to nbrStates - 1

1 Like

Thank you .
it’s cool.
As I am not familiar with the English language, can you tell me where I can find a document with the list of functions related to the different buttons?

First of all try my website - it has some guides for the more advanced features of G4P and the online API reference (JavaDocs)