wxDatePickerCtrl(3)
β¨ NAME β¨
Bestie, meet wxDatePickerCtrl π β this control lets the user pick a date. Like, a whole calendar vibe but tiny. It's an Erlang module definition situation, iykyk.
πΈ DESCRIPTION πΈ
Okay so unlike wxCalendarCtrl, which is giving big chunky calendar energy, wxDatePickerCtrl is a small window that just shows the currently selected date. Simple. Iconic. The control can be edited with the keyboard (yes, keys, slay), and depending on the styles used and the platform, it can also pop up a little window for a more user-friendly date selection moment. ποΈβ¨
Lowkey important: it's only available if wxUSE_DATEPICKCTRL is set to 1. No cap.
π Styles π
This class supports the following styles, and bestie you're gonna wanna know all of them:
wxDP_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. πwxDP_DROPDOWNβ Creates a control with a month calendar drop-down part, from which the user can select a date. This style is not supported in the OSX/Cocoa native version. πwxDP_DEFAULTβ Creates a control with the style that is best supported for the current platform. Currently that'swxDP_SPINunder Windows and OSX/Cocoa, andwxDP_DROPDOWNeverywhere else. Main character energy, fr fr.wxDP_ALLOWNONEβ With this style, the control lets the user not enter any valid date at all. Without it β the default β the control always has some valid date. This style is not supported in the OSX/Cocoa native version. πwxDP_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 the OSX/Cocoa native version currently. As you can see from the remarks above, most of the control styles are only supported in the native MSW implementation. In portable code it's recommended to usewxDP_DEFAULTstyle only, possibly combined withwxDP_SHOWCENTURY(this is also the style used by default if none is specified). Periodt. π
See:
wxCalendarCtrlwxDateEvent
This class is derived, and can use functions, from:
wxPickerBasewxControlwxWindowwxEvtHandler
wxWidgets docs: wxDatePickerCtrl
π¦ Events π¦
Event types emitted from this class:
date_changed
π DATA TYPES π
wxDatePickerCtrl() :: wx:wx_object().
π FUNCTIONS π
destroy(This :: wxDatePickerCtrl()) -> ok.
Destroys the object. Bye bestie π
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, this returns the lower and upper bounds of that 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, because the native control only supports dates later than year 1601. Wild, but true.
Return: false if no range limits are currently set, true if at least one bound is set. Simple as that. β¨
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. No thoughts, just date.
new() -> wxDatePickerCtrl().
Default constructor. The basics. π
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. A whole construction moment. π₯
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. So don't expect a notif, bestie.
Remark: If the current value of the control is outside of the newly set range bounds, the behaviour is undefined. π Not a vibe. Be careful.
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. So don't be waiting on one, okay? π
And that's the whole page, bestie! πβ¨ This absolute icon of a doc came from Ericsson AB, wx 2.6, dated wxDatePickerCtrl(3) β mwah, slay, bye! ππ¦π
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms