WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Button Class Reference

This class provides an easy way to link commands to OI inputs. More...

#include <Button.h>

Inheritance diagram for Button:
Trigger Sendable InternalButton JoystickButton NetworkButton

Public Member Functions

virtual void WhenPressed (Command *command)
 Specifies the command to run when a button is first pressed. More...
 
virtual void WhileHeld (Command *command)
 Specifies the command to be scheduled while the button is pressed The command will be scheduled repeatedly while the button is pressed and will be canceled when the button is released. More...
 
virtual void WhenReleased (Command *command)
 Specifies the command to run when the button is released The command will be scheduled a single time. More...
 
virtual void CancelWhenPressed (Command *command)
 Cancels the specificed command when the button is pressed. More...
 
virtual void ToggleWhenPressed (Command *command)
 Toggle the specified command when the button is pressed. More...
 
- Public Member Functions inherited from Trigger
bool Grab ()
 
virtual bool Get ()=0
 
void WhenActive (Command *command)
 
void WhileActive (Command *command)
 
void WhenInactive (Command *command)
 
void CancelWhenActive (Command *command)
 
void ToggleWhenActive (Command *command)
 
virtual void InitTable (std::shared_ptr< ITable > table)
 Initializes a table for this sendable object. More...
 
virtual std::shared_ptr< ITableGetTable () const
 
virtual std::string GetSmartDashboardType () const
 

Additional Inherited Members

- Protected Attributes inherited from Trigger
std::shared_ptr< ITablem_table
 

Detailed Description

This class provides an easy way to link commands to OI inputs.

It is very easy to link a button to a command. For instance, you could link the trigger button of a joystick to a "score" command.

This class represents a subclass of Trigger that is specifically aimed at buttons on an operator interface as a common use case of the more generalized Trigger objects. This is a simple wrapper around Trigger with the method names renamed to fit the Button object use.

Author
brad

Member Function Documentation

void Button::CancelWhenPressed ( Command command)
virtual

Cancels the specificed command when the button is pressed.

Parameters
Thecommand to be canceled
void Button::ToggleWhenPressed ( Command command)
virtual

Toggle the specified command when the button is pressed.

Parameters
Thecommand to be toggled
void Button::WhenPressed ( Command command)
virtual

Specifies the command to run when a button is first pressed.

Parameters
commandThe pointer to the command to run
void Button::WhenReleased ( Command command)
virtual

Specifies the command to run when the button is released The command will be scheduled a single time.

Parameters
Thepointer to the command to run
void Button::WhileHeld ( Command command)
virtual

Specifies the command to be scheduled while the button is pressed The command will be scheduled repeatedly while the button is pressed and will be canceled when the button is released.

Parameters
commandThe pointer to the command to run

The documentation for this class was generated from the following files: