# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # default style on this platform, either {Wx::DP_SPIN} or {Wx::DP_DROPDOWN} # DP_DEFAULT = 0 # a spin control-like date picker (not supported in generic version) # DP_SPIN = 1 # a combobox-like date picker (not supported on macOS <10.15.4) # DP_DROPDOWN = 2 # always show century in the default date display (otherwise it depends on the system date format which may include the century or not) # DP_SHOWCENTURY = 4 # allow not having any valid date in the control (by default it always has some date, today initially if no valid date specified in ctor) # DP_ALLOWNONE = 8 # This control allows the user to select a date. # Unlike {Wx::CalendarCtrl}, which is a relatively big control, {Wx::DatePickerCtrl} is implemented as a small window showing the currently selected date. The control can be edited using the keyboard, and can also display a popup window for more user-friendly date selection, depending on the styles used and the platform. # It is only available if {Wx::Setup::USE_DATEPICKCTRL} is set to 1. # === Styles # # This class supports the following styles: # # - {Wx::DP_SPIN}: Creates a control without a month calendar drop down but with spin-control-like arrows to change individual date components. This style is not supported by the generic version. # # - {Wx::DP_DROPDOWN}: Creates a control with a month calendar drop-down part from which the user can select a date. In OSX/Cocoa native version this style is supported on macOS 10.15.4 and later. # # - {Wx::DP_DEFAULT}: Creates a control with the style that is best supported for the current platform (currently {Wx::DP_SPIN} under Windows and OSX/Cocoa and {Wx::DP_DROPDOWN} elsewhere). # # - {Wx::DP_ALLOWNONE}: With this style, the control allows the user to not enter any valid date at all. Without it - the default - the control always has some valid date. This style is not supported in OSX/Cocoa native version. # # - {Wx::DP_SHOWCENTURY}: Forces display of the century in the default date format. Without this style the century could be displayed, or not, depending on the default date representation in the system. This style is not supported in OSX/Cocoa native version currently. # # As can be seen from the remarks above, most of the control style are only supported in the native MSW implementation. In portable code it's recommended to use {Wx::DP_DEFAULT} style only, possibly combined with {Wx::DP_SHOWCENTURY} (this is also the style used by default if none is specified). # === Events emitted by this class # # The following event-handler methods redirect the events to member method or handler blocks for {Wx::DateEvent} events. # Event handler methods for events emitted by this class: # # - {Wx::EvtHandler#evt_date_changed}(id, meth = nil, &block): Process a {Wx::EVT_DATE_CHANGED} event, which fires when the user changes the current selection in the control. # # === # # Category: Picker Controls
Appearance:
wxMSW Appearance # wxGTK Appearance # wxOSX Appearance #
# @see Wx::TimePickerCtrl # @see Wx::CalendarCtrl # @see Wx::DateEvent # # class DatePickerCtrl < Control # @overload initialize() # Default constructor. # @return [Wx::DatePickerCtrl] # @overload initialize(parent, id, dt=Wx::DEFAULT_DATE_TIME, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=(Wx::DP_DEFAULT|Wx::DP_SHOWCENTURY), validator=Wx::DEFAULT_VALIDATOR, name=("DATECTRL")) # Initializes the object and calls {Wx::DatePickerCtrl#create} with all the parameters. # @param parent [Wx::Window] # @param id [Integer] # @param dt [Time,Date,DateTime] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param style [Integer] # @param validator [Wx::Validator] # @param name [String] # @return [Wx::DatePickerCtrl] def initialize(*args) end # Create the control window. # This method should only be used for objects created using default constructor. # # true if the control was successfully created or false if creation failed. # @param parent [Wx::Window] Parent window, must not be non-NULL. # @param id [Integer] The identifier for the control. # @param dt [Time,Date,DateTime] The initial value of the control, if an invalid date (such as the default value) is used, the control is set to today. # @param pos [Array(Integer, Integer), Wx::Point] Initial position. # @param size [Array(Integer, Integer), Wx::Size] Initial size. If left at default value, the control chooses its own best size by using the height approximately equal to a text control and width large enough to show the date string fully. # @param style [Integer] The window style, see the description of the styles in the class documentation. # @param validator [Wx::Validator] Validator which can be used for additional data checks. # @param name [String] Control name. # @return [Boolean] def create(parent, id, dt=Wx::DEFAULT_DATE_TIME, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=(Wx::DP_DEFAULT|Wx::DP_SHOWCENTURY), validator=Wx::DEFAULT_VALIDATOR, name=("DATECTRL")) end # Returns the currently entered date. # For a control with {Wx::DP_ALLOWNONE} style the returned value may be invalid if no date is entered, otherwise it is always valid. # @return [Time,Date,DateTime] def get_value; end alias_method :value, :get_value # Set the text to show when there is no valid value. # For the controls with {Wx::DP_ALLOWNONE} style, set the string displayed when the control doesn't have any valid value. Currently this is only actually used under MSW, where it can be used to override the previous value which is still displayed by the control in this case, and ignored elsewhere. # Notably, text can be empty to completely hide the date if no valid date is specified. # @param text [String] # @return [void] def set_null_text(text) end alias_method :null_text=, :set_null_text # Sets the valid range for the date selection. # If dt1 is valid, it becomes the earliest date (inclusive) accepted by the control. If dt2 is valid, it becomes the latest possible date. # Notice that if the current value is not inside the new range, it will be adjusted to lie inside it, i.e. calling this method can change the control value, however no events are generated by it. # If the current value of the control is outside of the newly set range bounds, the behaviour is undefined. # @param dt1 [Time,Date,DateTime] # @param dt2 [Time,Date,DateTime] # @return [void] def set_range(dt1, dt2) end # Changes the current value of the control. # The date should be valid unless the control was created with {Wx::DP_ALLOWNONE} style and included in the currently selected range, if any. # Calling this method does not result in a date change event. # @param dt [Time,Date,DateTime] # @return [void] def set_value(dt) end alias_method :value=, :set_value end # DatePickerCtrl end