wxRuby Documentation Home

Wx::DatePickerCtrl

This control allows the user to select a date. Unlike CalendarCtrl, which is a relatively big control, 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, except PalmOS where date is selected using native dialog.

It is only available if USE_DATEPICKCTRL is set to $1$.

Derived from

Control

Window

EvtHandler

Object

Window styles

DP_SPIN Creates a control without a month calendardrop down but with spin-control-like arrows to change individual datecomponents. This style is not supported by the generic version.
DP_DROPDOWN Creates a control with a monthcalendar drop-down part from which the user can select a date.
DP_DEFAULT Creates a control with the stylethat is best supported for the current platform (currently DP_SPINunder Windows and DP_DROPDOWN elsewhere).
DP_ALLOWNONE With this style, the control allowsthe user to not enter any valid date at all. Without it – the default – the control always has some valid date.
DP_SHOWCENTURY Forces display of the century inthe default date format. Without this style the century could be displayed, ornot, depending on the default date representation in the system.

Event handling

evt_date_changed(id) { | event | ... } This event fires when the userchanges the current selection in the control.

See also

CalendarCtrl,

DateEvent

Methods

DatePickerCtrl.new

DatePickerCtrl.new(Window parent,  Integer id, 
                   DateTime dt = DefaultDateTime, 
                   Point pos = DEFAULT_POSITION, 
                   Size size = DEFAULT_SIZE, 
                   Integer style = DP_DEFAULT | DP_SHOWCENTURY, 
                   Validator validator = DEFAULT_VALIDATOR, 
                  String name = "datectrl")

Initializes the object and calls Create with all the parameters.

DatePickerCtrl#create

Boolean create(Window parent,  Integer id, 
               DateTime dt = DefaultDateTime, 
               Point pos = DEFAULT_POSITION, 
               Size size = DEFAULT_SIZE, 
               Integer style = DP_DEFAULT | DP_SHOWCENTURY, 
               Validator validator = DEFAULT_VALIDATOR, 
              String name = "datectrl")

Parameters

Return value

if the control was successfully created or  if creation failed.

DatePickerCtrl#get_range

Boolean get_range(DateTime dt1,  DateTime dt2)

If the control had been previously limited to a range of dates using set_range()(), returns the lower and upper bounds of this range. If no range is set (or only one of the bounds is set), dt1 and/or dt2 are set to be invalid.

Parameters

Return value set.

if no range limits are currently set,  if at least one bound is

DatePickerCtrl#get_value

DateTime get_value()

Returns the currently selected. If there is no selection or the selection is outside of the current range, an invalid object is returned.

DatePickerCtrl#set_range

set_range(DateTime dt1,  DateTime dt2)

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.

Remarks

If the current value of the control is outside of the newly set range bounds, the behaviour is undefined.

DatePickerCtrl#set_value

set_value(DateTime dt)

Changes the current value of the control. The date should be valid and included in the currently selected range, if any.

Calling this method does not result in a date change event.

[This page automatically generated from the Textile source at Fri Oct 31 16:06:40 +0000 2008]