Your company here — click to reach over 10,000 unique daily visitors

wxDatePickerCtrl.3erl - Man Page

Functions for wxDatePickerCtrl class


This control allows the user to select a date. Unlike wxCalendarCtrl, which is a relatively big control, wxDatePickerCtrl 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 wxUSE_DATEPICKCTRL is set to 1.


This class supports the following styles:

See: wxTimePickerCtrl (not implemented in wx), wxCalendarCtrl, wxDateEvent

This class is derived (and can use functions) from: wxPickerBase wxControl wxWindow wxEvtHandler

wxWidgets docs: wxDatePickerCtrl


Event types emitted from this class: date_changed

Data Types

wxDatePickerCtrl() = wx:wx_object()


new() -> wxDatePickerCtrl()

Default constructor.

new(Parent, Id) -> wxDatePickerCtrl()

Parent = wxWindow:wxWindow()
Id = integer()

new(Parent, Id, Options :: [Option]) -> wxDatePickerCtrl()

Parent = wxWindow:wxWindow()
Id = integer()
Option =
   {date, wx:wx_datetime()} |
   {pos, {X :: integer(), Y :: integer()}} |
   {size, {W :: integer(), H :: integer()}} |
   {style, integer()} |
   {validator, wx:wx_object()}

Initializes the object and calls Create() (not implemented in wx) with all the parameters.

getRange(This, Dt1, Dt2) -> boolean()

This = wxDatePickerCtrl()
Dt1 = Dt2 = wx:wx_datetime()

If the control had been previously limited to a range of dates using setRange/3, 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.

Notice that when using a native MSW implementation of this control the lower range is always set, even if setRange/3 hadn't been called explicitly, as the native control only supports dates later than year 1601.

Return: false if no range limits are currently set, true if at least one bound is set.

getValue(This) -> wx:wx_datetime()

This = wxDatePickerCtrl()

Returns the currently entered date.

For a control with wxDP_ALLOWNONE style the returned value may be invalid if no date is entered, otherwise it is always valid.

setRange(This, Dt1, Dt2) -> ok

This = wxDatePickerCtrl()
Dt1 = Dt2 = wx:wx_datetime()

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.

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

setValue(This, Dt) -> ok

This = wxDatePickerCtrl()
Dt = wx:wx_datetime()

Changes the current value of the control.

The date should be valid unless the control was created with wxDP_ALLOWNONE style and included in the currently selected range, if any.

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

destroy(This :: wxDatePickerCtrl()) -> ok

Destroys the object.


wx 2.4.1 wxWidgets team. Erlang Module Definition