wxFilePickerCtrl(3)

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

πŸ’– wxFilePickerCtrl πŸ’–

okay bestie, welcome to wxFilePickerCtrl β€” that's the Erlang module definition from the wx crew. it's a whole file-picking widget and honestly? it's giving main character energy. let's get into it πŸŽ€


✨ NAME ✨

wxFilePickerCtrl β€” this control allows the user to select a file. that's it, that's the job πŸ’…


🌸 DESCRIPTION 🌸

so the generic implementation is literally just a button, and when you click it, it brings up a wxFileDialog. slay. the native implementation may differ, but usually it's a (small) widget that gives you access to the file-chooser dialog. no cap.

important vibe check: this only exists if wxUSE_FILEPICKERCTRL is set to 1 (which is the default, so you're fine 🫢).

πŸ¦‹ Styles πŸ¦‹

this class supports the following styles, and you're gonna want to know all of them:

  • wxFLP_DEFAULT_STYLE β€” the default style: includes wxFLP_OPEN | wxFLP_FILE_MUST_EXIST and, under wxMSW and wxOSX, wxFLP_USE_TEXTCTRL.
  • wxFLP_USE_TEXTCTRL β€” creates a text control to the left of the picker button which is completely managed by the wxFilePickerCtrl and which can be used by the user to specify a path (see SetPath). the text control is automatically synchronized with button's value. use functions defined in wxPickerBase to modify the text control. iconic.
  • wxFLP_OPEN β€” creates a picker which allows the user to select a file to open.
  • wxFLP_SAVE β€” creates a picker which allows the user to select a file to save.
  • wxFLP_OVERWRITE_PROMPT β€” can be combined with wxFLP_SAVE only: ask confirmation to the user before selecting a file.
  • wxFLP_FILE_MUST_EXIST β€” can be combined with wxFLP_OPEN only: the file selected in the popup wxFileDialog must be an existing file. ⚠️ notice that it still remains possible for the user to enter a non-existent file name in the text control if wxFLP_USE_TEXTCTRL is also used, this flag is a hint for the user rather than a guarantee that the selected file does exist for the program.
  • wxFLP_CHANGE_DIR β€” change current working directory on each user file selection change.
  • wxFLP_SMALL β€” use smaller version of the control with a small "..." button instead of the normal "Browse" one. this flag is new since wxWidgets 2.9.3 ✨

See:

  • wxFileDialog
  • wxFileDirPickerEvent

this class is derived, and can use functions, from:

  • wxPickerBase
  • wxControl
  • wxWindow
  • wxEvtHandler

wxWidgets docs: wxFilePickerCtrl

πŸ’€ Events πŸ’€

event types emitted from this class:

  • command_filepicker_changed

πŸ‘‘ DATA TYPES πŸ‘‘

wxFilePickerCtrl() :: wx:wx_object().

🌈 FUNCTIONS 🌈

create(This, Parent, Id, [Option]) -> boolean()

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

creates this widget with the given parameters. periodt.

Return: true if the control was successfully created or false if creation failed. 😭


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

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

destroys the object πŸ’₯


getPath(This) -> unicode:charlist()

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

returns the absolute path of the currently selected file. obsessed 🫢


new() -> wxFilePickerCtrl().

new() -> wxFilePickerCtrl().

new(Parent, Id, [Option]) -> wxFilePickerCtrl()

new(Parent, Id, [Option]) -> wxFilePickerCtrl()
             when
                 Parent :: wxWindow:wxWindow(),
                 Id :: integer(),
                 Option ::
                     {path, unicode:chardata()} |
                     {message, unicode:chardata()} |
                     {wildcard, 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. literally just passes the vibes along ✨


setPath(This, Filename) -> ok

setPath(This, Filename) -> ok
                 when
                     This :: wxFilePickerCtrl(),
                     Filename :: unicode:chardata().

sets the absolute path of the currently selected file.

⚠️ okay so listen: if the control uses wxFLP_FILE_MUST_EXIST and does not use wxFLP_USE_TEXTCTRL style, the filename must be a name of an existing file and will be simply ignored by the native wxGTK implementation if this is not the case. (the generic implementation used under the other platforms accepts even invalid file names currently, but this is subject to change in the future, don't rely on being able to use non-existent paths with it). πŸ’€ fr fr, don't build your whole app on that.

and that's the whole page bestie, no skips, no cuts πŸ’–

this lil beauty was brought to you by Ericsson AB, version wx 2.6, dated wxFilePickerCtrl(3) β€” iykyk 😌 slay, go pick some files, you got this πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from