I stripped down the sample Selectable sample code so there's only one check box and I stripped down the onSelectable function to just the following.
function onSelectable(event) {
Sys.println("Instance " + event.getInstance());
Sys.println("PrevState " + event.getPreviousState());
Sys.println("GetState " + event.getInstance().getState());
return true;
}
When I click on the checkbox, it seems to call onSelectable 3 times and advance the state each time. I get the following output from a single click on the check box (in the simulator)
Instance Obj: 42
PrevState symbol (8389897)
GetState symbol (8389898)
Instance Obj: 42
PrevState symbol (8389898)
GetState symbol (8389899)
Instance Obj: 42
PrevState symbol (8389899)
GetState symbol (8389897)
Why does it seem to cycle through 3 of the 4 defined states automatically from a single click? I think I've cut out anything that could be manually altering the state in the rest of the code.