wxDatePickerCtrl(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

✨ 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's wxDP_SPIN under Windows and OSX/Cocoa, and wxDP_DROPDOWN everywhere 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 use wxDP_DEFAULT style only, possibly combined with wxDP_SHOWCENTURY (this is also the style used by default if none is specified). Periodt. πŸ‘‘

See:

  • 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

🌈 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