# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # A choice item is used to select one of a list of strings. # # Unlike a {Wx::ListBox}, only the selection is visible until the user pulls down the menu of choices. # ### Styles # # This class supports the following styles: # # - {Wx::CB_SORT}: Sorts the entries alphabetically. # # ### Events emitted by this class # # The following event-handler methods redirect the events to member method or handler blocks for {Wx::CommandEvent} events. # Event handler methods for events emitted by this class: # # - {Wx::EvtHandler#evt_choice}(id, meth = nil, &block): Process a {Wx::EVT_CHOICE} event, when an item on the list is selected. # # Category: {Wx::Controls}
Appearance:
WXMSW Appearance # WXGTK Appearance # WXOSX Appearance #
# @see Wx::ListBox # @see Wx::ComboBox # @see Wx::CommandEvent # # # @wxrb_require USE_CHOICE class Choice < ControlWithItems # Creates the choice for two-step construction. # # See {Wx::Choice#initialize}. # @param parent [Wx::Window] # @param id [Integer] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param choices [Array] # @param style [Integer] # @param validator [Wx::Validator] # @param name [String] # @return [Boolean] def create(parent, id, pos, size, choices, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::CHOICE_NAME_STR) end # @overload initialize() # Default constructor. # # # @see Wx::Choice#create # @see Wx::Validator # @return [Wx::Choice] # @overload initialize(parent, id, pos, size, choices, style=0, validator=Wx::DEFAULT_VALIDATOR, name=Wx::CHOICE_NAME_STR) # Constructor, creating and showing a choice. # # # @see Wx::Choice#create # @see Wx::Validator # @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 pos [Array(Integer, Integer), Wx::Point] Window position. # @param size [Array(Integer, Integer), Wx::Size] Window size. If {Wx::DEFAULT_SIZE} is specified then the choice is sized appropriately. # @param choices [Array] An array of strings with which to initialise the choice control. # @param style [Integer] Window style. See {Wx::Choice}. # @param validator [Wx::Validator] Window validator. # @param name [String] Window name. # @return [Wx::Choice] def initialize(*args) end # Gets the number of columns in this choice item. # #
# Remark: #

This is implemented for GTK and Motif only and always returns 1 for the other platforms. #

#
# @return [Integer] def get_columns; end alias_method :columns, :get_columns # Unlike {Wx::ControlWithItems#get_selection} which only returns the accepted selection value (the selection in the control once the user closes the dropdown list), this function returns the current selection. # # That is, while the dropdown list is shown, it returns the currently selected item in it. When it is not shown, its result is the same as for the other function. # @return [Integer] def get_current_selection; end alias_method :current_selection, :get_current_selection # Sets the number of columns in this choice item. # #
# Remark: #

This is implemented for GTK and Motif only and doesn’t do anything under other platforms. #

#
# @param n [Integer] Number of columns. # @return [void] def set_columns(n=1) end alias_method :columns=, :set_columns # Returns the number of items in the control. # # # @see Wx::Choice#is_empty # @return [Integer] def get_count; end alias_method :count, :get_count # Returns the index of the selected item or {Wx::NOT_FOUND} if no item is selected. # # The position of the current selection. # @see Wx::Choice#set_selection # @see Wx::Choice#get_string_selection # @return [Integer] def get_selection; end alias_method :selection, :get_selection # Sets the selection to the given item n or removes the selection entirely if n == {Wx::NOT_FOUND}. # # Note that this does not cause any command events to be emitted nor does it deselect any other items in the controls which support multiple selections. # @see Wx::Choice#set_string # @see Wx::Choice#set_string_selection # @param n [Integer] The string position to select, starting from zero. # @return [void] def set_selection(n) end alias_method :selection=, :set_selection # Finds an item whose label matches the given string. # # The zero-based position of the item, or {Wx::NOT_FOUND} if the string was not found. # @param string [String] String to find. # @param caseSensitive [Boolean] Whether search is case sensitive (default is not). # @return [Integer] def find_string(string, caseSensitive=false) end # Returns the label of the item with the given index. # # The index must be valid, i.e. less than the value returned by {Wx::Choice#get_count}, otherwise an assert is triggered. Notably, this function can't be called if the control is empty. # # The label of the item. # @param n [Integer] The zero-based index. # @return [String] def get_string(n) end alias_method :string, :get_string # Sets the label for the given item. # @param n [Integer] The zero-based item index. # @param string [String] The label to set. # @return [void] def set_string(n, string) end end # Choice end