Go to Post Maybe FIRST will just take 148's Tumbleweed and use it as the game piece for next year. - AndyB [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 16-03-2014, 18:21
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
Remap Button Action

Using Command Based Java, is it safe and will it work to remap a Button action at run-time?

Example, in the OI class:

Code:
public Button stick2_B = new JoystickButton(stick2, RobotMap.XBOX_B); 
stick2_B.whenPressed(new Command1());
Later, in the execute method of a command I want to do:

Code:
if(SOME_CONDITION)
{
    oi.stick2_B.whenPressed(new Command2());
}
I've already confirmed it will compile so the question is really if it will behave correctly at run-time. Specifically do I need to do anything to de-register stick2_B as a trigger for Command1 or any other sort up cleanup first? I would just test it but I don't have access to a robot until later this week for obvious reasons. Please don't tell me it should work or you think it will work Only if you know from knowledge of the WPILib or experience. Thanks!
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 13:11.

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