Go to Post it isn't about the technology but about the teams working together. Sneaky GDC has done it again. - dtengineering [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
  #6   Spotlight this post!  
Unread 25-03-2014, 13:09
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: How to change command associated with button

Quote:
Originally Posted by DjScribbles View Post
@jwakeman: your issue appears to be that your alternate condition was causing a new command to be created every iteration
Thanks for taking a look at my code. The second if condition in the actually has a 'not operator' (!) on the throwSwitch1.get() so I don't think I was creating new command every iteration.

Code:
        if(throwSwitch1.get() && oi.current_interface == oi.CONFIG_FIELD_INTERFACE)
        {
            oi.setPitInterface();
        }
        
        if(!throwSwitch1.get() && oi.current_interface == oi.CONFIG_PIT_INTERFACE)
        {
            oi.setFieldInterface();
        }
My code would probably be more readable if I used throwSwitch1.get() == false, throwSwitch1.get() == true. I like your suggestion of switching back and forth between pre-made commands instead of creating new every time I switch. This still leaves the issue of being able to unmap a command, i.e. have a button go from doing something to doing nothing. I suppose you could create a null command which does nothing and switch between that and the do something command.
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:06.

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