wxGenericDirCtrl(3)
π NAME π
okay so bestie, wxGenericDirCtrl is that control β the one you drop on any random window when you want a whole directory listing up in there (with optional files, because sometimes we want the files and sometimes we literally don't π). It's giving file-browser main character energy. Periodt.
β¨ DESCRIPTION β¨
So like, inside this control there's a wxTreeCtrl window doing the absolute most β it's the whole directory hierarchy, okay? The tree. The vibe. And then, optionally, there's a wxChoice window chilling right next to it holding a list of filters. Two besties, one control. No cap. π¦
πΈ Styles πΈ
This class supports the following styles, and yes you should read all of them because they all matter:
wxDIRCTRL_DIR_ONLYβ directories ONLY. no files. we said what we said. πwxDIRCTRL_3D_INTERNALβ gives the internal controls 3D borders. this one is the default, so it's already slaying unless you say otherwise.wxDIRCTRL_SELECT_FIRSTβ when you set the default path, it selects the first file in the directory. first place energy πwxDIRCTRL_SHOW_FILTERSβ shows that drop-down filter list. the little menu moment.wxDIRCTRL_EDIT_LABELSβ lets the folder and file labels be editable. yes you can rename things, go off βοΈwxDIRCTRL_MULTIPLEβ allows multiple files and folders to be selected. polyamorous selection, we love to see it π
This class is derived, and can use functions, from:
wxControlwxWindowwxEvtHandler
Inherited the whole family tree fr fr π
wxWidgets docs: wxGenericDirCtrl
π Events π
Event types emitted from this class, and honestly they're iconic:
dirctrl_selectionchangeddirctrl_fileactivated
π DATA TYPES π
wxGenericDirCtrl() :: wx:wx_object().
that's it. that's the type. simple. elegant. π«
π₯ FUNCTIONS π₯
collapseTree(This) -> okwhenThis :: wxGenericDirCtrl().
Collapses the entire tree. just β whole thing, gone, folded up. bye tree π³π€
create(This, Parent, [Option]) -> boolean()
when
This :: wxGenericDirCtrl(),
Parent :: wxWindow:wxWindow(),
Option ::
{id, integer()} |
{dir, unicode:chardata()} |
{pos, {X :: integer(), Y :: integer()}} |
{size, {W :: integer(), H :: integer()}} |
{style, integer()} |
{filter, unicode:chardata()} |
{defaultFilter, integer()}.
The create function for two-step construction, bestie. If you're doing the build-it-in-stages thing, this is your girl.
Peep new/2 for the details, okay? π
destroy(This :: wxGenericDirCtrl()) -> ok.
Destroys the object. it's over. it's giving closure π₯
expandPath(This, Path) -> boolean()
when
This :: wxGenericDirCtrl(),
Path :: unicode:chardata().
Tries to expand as much of the given path as possible β so that the filename or directory ends up visible in the tree control. like opening all the little folders to find your fave. so satisfying β¨
getDefaultPath(This) -> unicode:charlist()whenThis :: wxGenericDirCtrl().
Gets the default path. that's the whole thing.
getFilePath(This) -> unicode:charlist()whenThis :: wxGenericDirCtrl().
Gets the selected filename path only β and if there isn't one, you get an empty string, sorry babe π
Real talk: this function doesn't count a directory as a selection. So if a folder is selected, it's not gonna give you that path. nope. π
getFilter(This) -> unicode:charlist()whenThis :: wxGenericDirCtrl().
Returns the filter string.
getFilterIndex(This) -> integer()whenThis :: wxGenericDirCtrl().
Returns the current filter index. and it's zero-based, keep that in mind or you WILL be off by one, iykyk π
getPath(This) -> unicode:charlist()whenThis :: wxGenericDirCtrl().
Gets the currently-selected directory or filename. the one you're on rn π«Ά
getPath(This, ItemId) -> unicode:charlist()whenThis :: wxGenericDirCtrl(), ItemId :: integer().
Gets the path corresponding to the given tree control item.
Since: 2.9.5 β
getRootId(This) -> integer()whenThis :: wxGenericDirCtrl().
Returns the root id for the tree control. the source. the origin. the mother of the tree π
getTreeCtrl(This) -> wxTreeCtrl:wxTreeCtrl()whenThis :: wxGenericDirCtrl().
Returns a pointer to the tree control.
init(This) -> okwhenThis :: wxGenericDirCtrl().
Initializes variables. just setting the stage, bestie π¬
new() -> wxGenericDirCtrl().
Default constructor. no args, no stress π
new(Parent, [Option]) -> wxGenericDirCtrl()
when
Parent :: wxWindow:wxWindow(),
Option ::
{id, integer()} |
{dir, unicode:chardata()} |
{pos, {X :: integer(), Y :: integer()}} |
{size, {W :: integer(), H :: integer()}} |
{style, integer()} |
{filter, unicode:chardata()} |
{defaultFilter, integer()}.
Main constructor!! this is the one you'll actually be using. go off π
reCreateTree(This) -> okwhenThis :: wxGenericDirCtrl().
Collapse and expand the tree, thus re-creating it from scratch. it's like a little glow-up for the tree β¨
May be used to update the displayed directory content. so if the directory changed and the control needs to know β this. yes.
setDefaultPath(This, Path) -> ok
when
This :: wxGenericDirCtrl(),
Path :: unicode:chardata().
Sets the default path.
setFilter(This, Filter) -> ok
when
This :: wxGenericDirCtrl(),
Filter :: unicode:chardata().
Sets the filter string.
setFilterIndex(This, N) -> okwhenThis :: wxGenericDirCtrl(), N :: integer().
Sets the current filter index. and yes, it's zero-based again, don't forget, bestie π
setPath(This, Path) -> ok
when
This :: wxGenericDirCtrl(),
Path :: unicode:chardata().
Sets the current path. that's it, you're moved in π‘
π§ okay that's the whole page!! you ate that fr fr. go build something cute with your directory listing. mwah π
This was brought to you by Ericsson AB π, the wx 2.6 era πΈ, and the one and only wxGenericDirCtrl(3) β stay iconic, bestie πβ¨π¦
π¦ 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