wxDirPickerCtrl(3)

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

πŸ’– wxDirPickerCtrl πŸ’–

okay bestie, so this is the Erlang module definition for wxDirPickerCtrl β€” literally just a whole control that lets your user pick a directory. That's it. That's the vibe. πŸ—‚οΈβœ¨


🌸 NAME 🌸

wxDirPickerCtrl β€” a control that lets the user select a directory, fr fr.


✨ DESCRIPTION ✨

So here's the tea πŸ«–: the generic implementation is a button that brings up a wxDirDialog when you click it. The native implementation may differ, but bestie, it's usually a (small) widget that gives you access to the dir-chooser dialog. Iconic behavior honestly. πŸ‘‘

It's only available if wxUSE_DIRPICKERCTRL is set to 1 (which is the default, so like, you're fine πŸ’…).

πŸŽ€ Styles πŸŽ€

This class supports the following styles, no cap:

  • wxDIRP_DEFAULT_STYLE β€” the default style, the main character ✨. It includes wxDIRP_DIR_MUST_EXIST and, under wxMSW only, wxDIRP_USE_TEXTCTRL.
  • wxDIRP_USE_TEXTCTRL β€” creates a text control to the left of the picker button which is completely managed by the wxDirPickerCtrl and which can be used by the user to specify a path (see SetPath). The text control is automatically synchronized with the button's value. Use functions defined in wxPickerBase to modify the text control. The way it just... syncs itself 😭 obsessed.
  • wxDIRP_DIR_MUST_EXIST β€” creates a picker that allows selecting only existing directories in the popup wxDirDialog. ⚠️ Notice that, as with wxFLP_FILE_MUST_EXIST, it is still possible to enter a non-existent directory even when this file is specified if the wxDIRP_USE_TEXTCTRL style is also used. Also note that if wxDIRP_USE_TEXTCTRL is not used, the native wxGTK implementation always uses this style as it doesn't support selecting non-existent directories. Very "we do it differently over here" energy.
  • wxDIRP_CHANGE_DIR β€” change current working directory on each user directory selection change. Just casually rearranging your whole filesystem vibe. 🌈
  • wxDIRP_SMALL β€” use a smaller version of the control with a small "..." button instead of the normal "Browse" one. This flag is new since wxWidgets 2.9.3 🌱 (so it was born in 2.9.3, baby of the family).

See:

  • wxDirDialog
  • wxFileDirPickerEvent

This class is derived, and can use functions, from β€” the whole family tree 🌳:

  • wxPickerBase
  • wxControl
  • wxWindow
  • wxEvtHandler

wxWidgets docs: wxDirPickerCtrl

πŸ”” Events πŸ””

Event types emitted from this class β€” the notifications it's sending you:

  • command_dirpicker_changed πŸ“£

🌈 DATA TYPES 🌈

wxDirPickerCtrl() :: wx:wx_object().

Just a lil object, your everyday Erlang wx object bestie. 🫢


πŸ‘‘ FUNCTIONS πŸ‘‘

πŸ’« create

create(This, Parent, Id, [Option]) -> boolean()
                when
                    This :: wxDirPickerCtrl(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Option ::
                        {path, unicode:chardata()} |
                        {message, unicode:chardata()} |
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()} |
                        {validator, wx:wx_object()}.

Creates the widgets with the given parameters. Build-a-widget workshop πŸ› οΈβœ¨

Return: true if the control was successfully created or false if creation failed. Slay or flop, no in-between πŸ’€


πŸ’« destroy

destroy(This :: wxDirPickerCtrl()) -> ok.

Destroys the object πŸ’₯ okay bye bestie, it's giving closure.


πŸ’« getPath

getPath(This) -> unicode:charlist() when This :: wxDirPickerCtrl().

Returns the absolute path of the currently selected directory. It will literally tell you where you're standing. πŸ“πŸ’…


πŸ’« new (the no-args one) 🌱

new() -> wxDirPickerCtrl().

Fresh out the box, no arguments, brand new. ✨


πŸ’« new (the full-glow-up one) 🌟

new(Parent, Id, [Option]) -> wxDirPickerCtrl()
                when
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Option ::
                        {path, unicode:chardata()} |
                        {message, unicode:chardata()} |
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()} |
                        {validator, wx:wx_object()}.

Initializes the object and calls create/4 with all the parameters. So it's basically the "do the whole routine in one go" version πŸƒβ™€οΈπŸ’¨


πŸ’« setPath

setPath(This, Dirname) -> ok
                when
                    This :: wxDirPickerCtrl(),
                    Dirname :: unicode:chardata().

Sets the absolute path of the currently selected directory. You're the one choosing where it lives now. 🎯

⚠️ Important bestie, listen up: If the control uses wxDIRP_DIR_MUST_EXIST and does not use the wxDIRP_USE_TEXTCTRL style, the dirname must be a name of an existing directory and will be simply ignored by the native wxGTK implementation if this is not the case. So like, don't come crying to me when wxGTK just ✨pretends you never said anything✨ πŸ’€

mwah, that's a wrap πŸ’‹ This manual page came to you from Ericsson AB, covering wx 2.6, and yes it's the wxDirPickerCtrl(3) page β€” thank you for coming to my TED talk, go pick some directories, periodt. πŸ‘‘πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from