Go to Post Aaaaah! I think my head just exploded from looking at this awesomeness. You guys are great. This is super cool. :) - Ian Curtis [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 23-02-2013, 11:14
ssong1995 ssong1995 is offline
Registered User
FRC #1403
 
Join Date: Oct 2011
Location: Belle Mead
Posts: 12
ssong1995 is an unknown quantity at this point
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;
}
}
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 14:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi