---
name: "wxGenericDirCtrl"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/wxGenericDirCtrl"
---

# wxGenericDirCtrl(3erl)

Functions for wxGenericDirCtrl class

## NAME

wxGenericDirCtrl - Functions for wxGenericDirCtrl class

## DESCRIPTION

This control can be used to place a directory listing (with optional files) on an arbitrary window.

The control contains a *wxTreeCtrl* window representing the directory hierarchy, and optionally, a *wxChoice* window containing a list of filters.

Styles

This class supports the following styles:

This class is derived (and can use functions) from: *wxControl* *wxWindow* *wxEvtHandler*

wxWidgets docs: wxGenericDirCtrl

## EVENTS

Event types emitted from this class: *dirctrl\_selectionchanged*, *dirctrl\_fileactivated*

## DATA TYPES

```
wxGenericDirCtrl() = wx:wx_object()
```

## EXPORTS

```
new() -> wxGenericDirCtrl()
```

Default constructor.

```
new(Parent) -> wxGenericDirCtrl()
```

Types:

Parent = wxWindow:wxWindow()\

```
new(Parent, Options :: [Option]) -> wxGenericDirCtrl()
```

Types:

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.

```
destroy(This :: wxGenericDirCtrl()) -> ok
```

Destructor.

```
create(This, Parent) -> boolean()
```

Types:

This = wxGenericDirCtrl()\
 Parent = wxWindow:wxWindow()\

```
create(This, Parent, Options :: [Option]) -> boolean()
```

Types:

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()}\

Create function for two-step construction.

See *new/2* for details.

```
init(This) -> ok
```

Types:

This = wxGenericDirCtrl()\

Initializes variables.

```
collapseTree(This) -> ok
```

Types:

This = wxGenericDirCtrl()\

Collapses the entire tree.

```
expandPath(This, Path) -> boolean()
```

Types:

This = wxGenericDirCtrl()\
 Path = unicode:chardata()\

Tries to expand as much of the given *path* as possible, so that the filename or directory is visible in the tree control.

```
getDefaultPath(This) -> unicode:charlist()
```

Types:

This = wxGenericDirCtrl()\

Gets the default path.

```
getPath(This) -> unicode:charlist()
```

Types:

This = wxGenericDirCtrl()\

Gets the currently-selected directory or filename.

```
getPath(This, ItemId) -> unicode:charlist()
```

Types:

This = wxGenericDirCtrl()\
 ItemId = integer()\

Gets the path corresponding to the given tree control item.

Since: 2.9.5

```
getFilePath(This) -> unicode:charlist()
```

Types:

This = wxGenericDirCtrl()\

Gets selected filename path only (else empty string).

This function doesn't count a directory as a selection.

```
getFilter(This) -> unicode:charlist()
```

Types:

This = wxGenericDirCtrl()\

Returns the filter string.

```
getFilterIndex(This) -> integer()
```

Types:

This = wxGenericDirCtrl()\

Returns the current filter index (zero-based).

```
getRootId(This) -> integer()
```

Types:

This = wxGenericDirCtrl()\

Returns the root id for the tree control.

```
getTreeCtrl(This) -> wxTreeCtrl:wxTreeCtrl()
```

Types:

This = wxGenericDirCtrl()\

Returns a pointer to the tree control.

```
reCreateTree(This) -> ok
```

Types:

This = wxGenericDirCtrl()\

Collapse and expand the tree, thus re-creating it from scratch.

May be used to update the displayed directory content.

```
setDefaultPath(This, Path) -> ok
```

Types:

This = wxGenericDirCtrl()\
 Path = unicode:chardata()\

Sets the default path.

```
setFilter(This, Filter) -> ok
```

Types:

This = wxGenericDirCtrl()\
 Filter = unicode:chardata()\

Sets the filter string.

```
setFilterIndex(This, N) -> ok
```

Types:

This = wxGenericDirCtrl()\
 N = integer()\

Sets the current filter index (zero-based).

```
setPath(This, Path) -> ok
```

Types:

This = wxGenericDirCtrl()\
 Path = unicode:chardata()\

Sets the current path.
