wxDatePickerCtrl — wx v2.4.2

Search documentation of wx

# View Source wxDatePickerCtrl (wx v2.4.2)

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.

Styles

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

## Events

Event types emitted from this class: `date_changed`

# Summary

## Types

wxDatePickerCtrl()

## Functions

destroy(This)

Destroys the object.

getRange(This, Dt1, Dt2)

If the control had been previously limited to a range of dates using `setRange/3`, returns the lower and upper bounds of this range.

getValue(This)

Returns the currently entered date.

new()

Default constructor.

new(Parent, Id)
new/3

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

setRange(This, Dt1, Dt2)

Sets the valid range for the date selection.

setValue(This, Dt)

Changes the current value of the control.

# Types

Link to this type

# wxDatePickerCtrl()

View Source

    -type wxDatePickerCtrl() :: wx:wx_object().

# Functions

Link to this function

# destroy(This)

View Source

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

Destroys the object.

Link to this function

# getRange(This, Dt1, Dt2)

View Source

    -spec getRange(This, Dt1, Dt2) -> boolean()
                      when This :: wxDatePickerCtrl(), Dt1 :: wx:wx_datetime(), 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.

Link to this function

# getValue(This)

View Source

    -spec getValue(This) -> wx:wx_datetime() when 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.

Link to this function

# new()

View Source

    -spec new() -> wxDatePickerCtrl().

Default constructor.

Link to this function

# new(Parent, Id)

View Source

    -spec new(Parent, Id) -> wxDatePickerCtrl() when Parent :: wxWindow:wxWindow(), Id :: integer().

Link to this function

# new/3

View Source

    -spec new(Parent, Id, [Option]) -> wxDatePickerCtrl()
                 when
                     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.

Link to this function

# setRange(This, Dt1, Dt2)

View Source

    -spec setRange(This, Dt1, Dt2) -> ok
                      when This :: wxDatePickerCtrl(), Dt1 :: wx:wx_datetime(), 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.

Link to this function

# setValue(This, Dt)

View Source

    -spec setValue(This, Dt) -> ok when 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.