my name is Javier, from Spain
At first, apologize for my inexperience, and for my english :)
This is question anyway:
I'm looking for getting a button state in Apache Pivot. I've tried with many listeners, without result. I don't find any property as "state", "value" or similar.
The closest thing I've found is:
//Intercepta los eventos de toggleButton
BotonGenerico.getButtonStateListeners() .add(new ButtonStateListener() {
@Override
public void stateChanged(Button button, State previousState) {
System.out.println("Changed!");
}
});
But doesn't seem working.
Thanks
I'm going to answer myself, after researching the issue, if anyone is interested:
In Apache Pivot there is no control called "toggle button" as such. Instead of this, i can use the control called "button".
In my case, "BotonGenerico" can transformed in ToggleButton, only changing the toggleButton property via setToggleButton:
After this, I can view or change it state, via getState and setState:
On many cases, we have to work with 'components', instead 'pushbuttons' (p.e. in some events as mouseMove, mouseOut. focusedChanged...). Casting that mentioned 'component' to button, is simply to manipulate.
Sample:
Hope this helps.