# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # # EVT_SPINCTRL = 10131 # # EVT_SPINCTRLDOUBLE = 10132 # {Wx::SpinCtrl} combines {Wx::TextCtrl} and {Wx::SpinButton} in one control. # === Styles # # This class supports the following styles: # # - {Wx::SP_ARROW_KEYS}: The user can use arrow keys to change the value. # # - {Wx::SP_WRAP}: The value wraps at the minimum and maximum. # # - {Wx::TE_PROCESS_ENTER}: Indicates that the control should generate {Wx::EVT_TEXT_ENTER} events. Using this style will prevent the user from using the Enter key for dialog navigation (e.g. activating the default button in the dialog) under MSW. # # - {Wx::Alignment::ALIGN_LEFT}: Same as {Wx::TE_LEFT} for {Wx::TextCtrl}: the text is left aligned (this is the default). # # - {Wx::Alignment::ALIGN_CENTRE_HORIZONTAL}: Same as {Wx::TE_CENTRE} for {Wx::TextCtrl}: the text is centered. # # - {Wx::Alignment::ALIGN_RIGHT}: Same as {Wx::TE_RIGHT} for {Wx::TextCtrl}: the text is right aligned. # # === Events emitted by this class # # The following event-handler methods redirect the events to member method or handler blocks for {Wx::SpinEvent} events. # Event handler methods for events emitted by this class: # # - {Wx::EvtHandler#evt_spinctrl}(id, meth = nil, &block): Process a {Wx::EVT_SPINCTRL} event, which is generated whenever the numeric value of the spin control is updated. # # You may also use the {Wx::SpinButton} event macros, however the corresponding events will not be generated under all platforms. Finally, if the user modifies the text in the edit part of the spin control directly, the EVT_TEXT is generated, like for the {Wx::TextCtrl}. When the use enters text into the text area, the text is not validated until the control loses focus (e.g. by using the TAB key). The value is then adjusted to the range and a {Wx::SpinEvent} sent then if the value is different from the last value sent. # === # # Category: {Wx::Controls}
Appearance:
wxMSW Appearance # wxGTK Appearance # wxOSX Appearance #
# @see Wx::SpinButton # @see Wx::SpinCtrlDouble # @see Wx::Control # # class SpinCtrl < Control # @overload initialize() # Default constructor. # @return [Wx::SpinCtrl] # @overload initialize(parent, id=Wx::StandardID::ID_ANY, value=(''), pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::SP_ARROW_KEYS, min=0, max=100, initial=0, name=("Wx::SpinCtrl")) # Constructor, creating and showing a spin control. # If value is non-empty, it will be shown in the text entry part of the control and if it has numeric value, the initial numeric value of the control, as returned by {Wx::SpinCtrl#get_value} will also be determined by it instead of by initial. Hence, it only makes sense to specify initial if value is an empty string or is not convertible to a number, otherwise initial is simply ignored and the number specified by value is used. # @see Wx::SpinCtrl#create # @param parent [Wx::Window] Parent window. Must not be NULL. # @param id [Integer] Window identifier. The value {Wx::StandardID::ID_ANY} indicates a default value. # @param value [String] Default value (as text). # @param pos [Array(Integer, Integer), Wx::Point] Window position. If {Wx::DEFAULT_POSITION} is specified then a default position is chosen. # @param size [Array(Integer, Integer), Wx::Size] Window size. If {Wx::DEFAULT_SIZE} is specified then a default size is chosen. # @param style [Integer] Window style. See {Wx::SpinButton}. # @param min [Integer] Minimal value. # @param max [Integer] Maximal value. # @param initial [Integer] Initial value. # @param name [String] Window name. # @return [Wx::SpinCtrl] def initialize(*args) end # Creation function called by the spin control constructor. # See {Wx::SpinCtrl#initialize} for details. # @param parent [Wx::Window] # @param id [Integer] # @param value [String] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param style [Integer] # @param min [Integer] # @param max [Integer] # @param initial [Integer] # @param name [String] # @return [Boolean] def create(parent, id=Wx::StandardID::ID_ANY, value=(''), pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::SP_ARROW_KEYS, min=0, max=100, initial=0, name=("Wx::SpinCtrl")) end # Returns the numerical base being currently used, 10 by default. # # @see Wx::SpinCtrl#set_base # @return [Integer] def get_base; end alias_method :base, :get_base # Gets maximal allowable value. # @return [Integer] def get_max; end alias_method :max, :get_max # Gets minimal allowable value. # @return [Integer] def get_min; end alias_method :min, :get_min # Returns the text in the text entry part of the control. # @return [String] def get_text_value; end alias_method :text_value, :get_text_value # Gets the value of the spin control. # @return [Integer] def get_value; end alias_method :value, :get_value # Get the value for increment for a spin control. # The default value is 1 but it can be changed using {Wx::SpinCtrl#set_increment}. # @return [Integer] def get_increment; end alias_method :increment, :get_increment # Sets the base to use for the numbers in this control. # Currently the only supported values are 10 (which is the default) and 16. # Changing the base allows the user to enter the numbers in the specified base, e.g. with "0x" prefix for hexadecimal numbers, and also displays the numbers in the specified base when they are changed using the spin control arrows. # Setting a base to 16 is allowed only if current range does not include negative values. # # true if the base was successfully changed or false if it failed, usually meaning that either the base is not 10 or 16 or that the base is not supported for values in the current range. # @param base [Integer] Numeric base, currently only 10 and 16 are supported. # @return [Boolean] def set_base(base) end alias_method :base=, :set_base # Sets range of allowable values. # Notice that calling this method may change the value of the control if it's not inside the new valid range, e.g. it will become minVal if it is less than it now. However no {Wx::EVT_SPINCTRL} event is generated, even if it the value does change. # Setting a range including negative values is silently ignored if current base is set to 16. # @param minVal [Integer] # @param maxVal [Integer] # @return [void] def set_range(minVal, maxVal) end # Select the text in the text part of the control between positions from (inclusive) and to (exclusive). # This is similar to {Wx::TextCtrl#set_selection}. # this is currently only implemented for Windows and generic versions of the control. # @param from [Integer] # @param to [Integer] # @return [void] def set_selection(from, to) end # @overload set_value(text) # Sets the value of the spin control. # It is recommended to use the overload taking an integer value instead. If text doesn't represent a valid number, it may not be shown in the text part of the control at all (only empty string is guaranteed to be supported under all platforms) and the numeric value will be changed to {Wx::SpinCtrl#get_min}. # Notice that, unlike {Wx::TextCtrl#set_value}, but like most of the other setter methods in wxWidgets, calling this method does not generate any events as events are only generated for the user actions. # @param text [String] # @return [void] # @overload set_value(value) # Sets the value of the spin control. # Calling this method doesn't generate any {Wx::EVT_SPINCTRL} events. # @param value [Integer] # @return [void] def set_value(*args) end alias_method :value=, :set_value # Sets the increment for the control. # The increment is the number by which the value changes when the up or down arrow is used. # The default is 1, but it can be useful to set it to a higher value when using the control for bigger numbers. # Note that it is still possible to enter any value (in the valid range) into the control manually, whatever is the value of the increment. # @param value [Integer] # @return [void] def set_increment(value) end alias_method :increment=, :set_increment end # SpinCtrl end