|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Command-Based robot button toggle question
We are having a problem regarding making a toggle method for the button class. In the OI file, we plan to code certain buttons such that the first time its pressed one command would execute, the next time a different command would, and it would alternate between (thus toggling between these two states).
One of the powerpoints we came across described going into the Button source code file and adding a new method, so we wrote a new one that accepts two commands as the parameters and have worked out the logic for the toggle. It doesn't seem to be working, so could someone explain the proper way to code it? Thank you very much. state is set to false in the beginning, and: void Button::WhenToggled(Command *command1, Command *command2){ if(state){ WhenActive(command2); state = false; } else { WhenActive(command1); state = true; } } |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|