Class FtcValueMenu

java.lang.Object
ftclib.driverio.FtcMenu
ftclib.driverio.FtcValueMenu

public class FtcValueMenu extends FtcMenu
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.
  • Field Details

    • minValue

      private final double minValue
    • maxValue

      private final double maxValue
    • valueStep

      private final double valueStep
    • valueFormat

      private final String valueFormat
    • defaultValue

      private final FtcValueMenu.DefaultValue defaultValue
    • currValue

      private Double currValue
    • multiplier

      private double multiplier
    • childMenu

      private FtcMenu 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

      public void setChildMenu(FtcMenu childMenu)
      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

      public FtcMenu getChildMenu()
      This method returns the child menu.
      Specified by:
      getChildMenu in class FtcMenu
      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 class FtcMenu