Package ftclib.driverio
Class FtcValueMenu
java.lang.Object
ftclib.driverio.FtcMenu
ftclib.driverio.FtcValueMenu
This class implements a value menu where a default value is displayed. The user can press the UP and DOWN button
to increase or decrease the value and press the ENTER button to select the value. The user can also press the
BACK button to cancel the menu and go back to the parent menu.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
This interface can be used to dynamically set the Value Menu default value.Nested classes/interfaces inherited from class ftclib.driverio.FtcMenu
FtcMenu.MenuButtons
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FtcMenu
private Double
private final FtcValueMenu.DefaultValue
private final double
private final double
private double
private final String
private final double
-
Constructor Summary
ConstructorsConstructorDescriptionFtcValueMenu
(String menuTitle, FtcMenu parent, double minValue, double maxValue, double valueStep, double defaultValue, String valueFormat) Constructor: Create an instance of the object.FtcValueMenu
(String menuTitle, FtcMenu parent, double minValue, double maxValue, double valueStep, FtcValueMenu.DefaultValue defaultValue, String valueFormat) Constructor: Create an instance of the object.FtcValueMenu
(String menuTitle, FtcMenu parent, FtcMenu.MenuButtons menuButtons, double minValue, double maxValue, double valueStep, double defaultValue, String valueFormat) Constructor: Create an instance of the object.FtcValueMenu
(String menuTitle, FtcMenu parent, FtcMenu.MenuButtons menuButtons, double minValue, double maxValue, double valueStep, FtcValueMenu.DefaultValue defaultValue, String valueFormat) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method displays the menu on the dashboard with the current value in the specified format.This method returns the child menu.double
This method returns the current value of the value menu.void
This method decreases the multiplier of valueStep by 10 times.void
This method increases the multiplier of valueStep by 10 times.void
menuDown()
This method decreases the current value by valueStep.void
menuUp()
This method increases the current value by valueStep.void
setChildMenu
(FtcMenu childMenu) This method sets the next menu to go to after pressing ENTER on the value menu.Methods inherited from class ftclib.driverio.FtcMenu
getParentMenu, getTitle, runMenus, setRootMenu, walkMenuTree
-
Field Details
-
minValue
private final double minValue -
maxValue
private final double maxValue -
valueStep
private final double valueStep -
valueFormat
-
defaultValue
-
currValue
-
multiplier
private double multiplier -
childMenu
-
-
Constructor Details
-
FtcValueMenu
public FtcValueMenu(String menuTitle, FtcMenu parent, FtcMenu.MenuButtons menuButtons, double minValue, double maxValue, double valueStep, double defaultValue, String valueFormat) Constructor: Create an instance of the object.- Parameters:
menuTitle
- specifies the title of the menu. The title will be displayed as the first line in the menu.parent
- specifies the parent menu to go back to if the BACK button is pressed. If this is the root menu, it can be set to null.menuButtons
- specifies the object that implements the MenuButtons interface.minValue
- specifies the minimum value of the value range.maxValue
- specifies the maximum value of the value range.valueStep
- specifies the value step.defaultValue
- specifies the default value.valueFormat
- specifies the format string for the value.
-
FtcValueMenu
public FtcValueMenu(String menuTitle, FtcMenu parent, FtcMenu.MenuButtons menuButtons, double minValue, double maxValue, double valueStep, FtcValueMenu.DefaultValue defaultValue, String valueFormat) Constructor: Create an instance of the object.- Parameters:
menuTitle
- specifies the title of the menu. The title will be displayed as the first line in the menu.parent
- specifies the parent menu to go back to if the BACK button is pressed. If this is the root menu, it can be set to null.menuButtons
- specifies the object that implements the MenuButtons interface.minValue
- specifies the minimum value of the value range.maxValue
- specifies the maximum value of the value range.valueStep
- specifies the value step.defaultValue
- specifies the method to call to set default value.valueFormat
- specifies the format string for the value.
-
FtcValueMenu
public FtcValueMenu(String menuTitle, FtcMenu parent, double minValue, double maxValue, double valueStep, double defaultValue, String valueFormat) Constructor: Create an instance of the object.- Parameters:
menuTitle
- specifies the title of the menu. The title will be displayed as the first line in the menu.parent
- specifies the parent menu to go back to if the BACK button is pressed. If this is the root menu, it can be set to null.minValue
- specifies the minimum value of the value range.maxValue
- specifies the maximum value of the value range.valueStep
- specifies the value step.defaultValue
- specifies the default value.valueFormat
- specifies the format string for the value.
-
FtcValueMenu
public FtcValueMenu(String menuTitle, FtcMenu parent, double minValue, double maxValue, double valueStep, FtcValueMenu.DefaultValue defaultValue, String valueFormat) Constructor: Create an instance of the object.- Parameters:
menuTitle
- specifies the title of the menu. The title will be displayed as the first line in the menu.parent
- specifies the parent menu to go back to if the BACK button is pressed. If this is the root menu, it can be set to null.minValue
- specifies the minimum value of the value range.maxValue
- specifies the maximum value of the value range.valueStep
- specifies the value step.defaultValue
- specifies the method to call to set default value.valueFormat
- specifies the format string for the value.
-
-
Method Details
-
setChildMenu
This method sets the next menu to go to after pressing ENTER on the value menu.- Parameters:
childMenu
- specifies the child menu.
-
getCurrentValue
public double getCurrentValue()This method returns the current value of the value menu. Every value menu has a current value even if the menu hasn't been displayed and the user hasn't changed the value. In that case, the current value is the default value.- Returns:
- current value of the value menu.
-
getChildMenu
This method returns the child menu.- Specified by:
getChildMenu
in classFtcMenu
- Returns:
- child menu.
-
displayMenu
public void displayMenu()This method displays the menu on the dashboard with the current value in the specified format.- Specified by:
displayMenu
in classFtcMenu
-