wxTreeCtrl(3)

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

πŸ’– wxTreeCtrl πŸ’–

okay bestie, so this is the Erlang module definition of wxTreeCtrl, and it's giving hierarchy realness β€” a tree control that shows info as a tree, where items can expand to reveal more items. 🌳✨


🌸 NAME 🌸

wxTreeCtrl β€” a tree control presents information as a hierarchy, with items that may be expanded to show further items. literally the blueprint for every cute nested menu you've ever seen πŸ’…


✨ DESCRIPTION ✨

Items in a tree control are referenced by wxTreeItemId handles β€” and heads up, that's not implemented in wx. You can vibe-check whether a handle is valid by calling wxTreeItemId::IsOk() (also not implemented in wx πŸ™ˆ).

There's a similar control with a fully native implementation for GTK+ and macOS as well, called wxDataViewTreeCtrl (not implemented in wx, iykyk 😭).

To intercept events from a tree control, use the event table macros described in wxTreeEvent. πŸŽ€

πŸ¦‹ Styles πŸ¦‹

This class supports the following styles:

  • wxTR_EDIT_LABELS β€” Use this style if you wish the user to be able to edit labels in the tree control. let them cook ✍️
  • wxTR_NO_BUTTONS β€” For convenience to document that no buttons are to be drawn.
  • wxTR_HAS_BUTTONS β€” Use this style to show + and - buttons to the left of parent items.
  • wxTR_TWIST_BUTTONS β€” Selects alternative style of +/- buttons and shows rotating ("twisting") arrows instead. Currently this style is only implemented under Microsoft Windows Vista and later Windows versions and is ignored under the other platforms, as enabling it is equivalent to using wxSystemThemedControl::EnableSystemTheme() (not implemented in wx).
  • wxTR_NO_LINES β€” Use this style to hide vertical level connectors.
  • wxTR_FULL_ROW_HIGHLIGHT β€” Use this style to have the background colour and the selection highlight extend over the entire horizontal row of the tree control window. (This flag is ignored under Windows unless you specify wxTR_NO_LINES as well.)
  • wxTR_LINES_AT_ROOT β€” Use this style to show lines leading to the root nodes (unless no wxTR_NO_LINES is also used, in which case no lines are shown). Note that in the MSW version, if this style is omitted, not only the lines, but also the button used for expanding the root item is not shown, which can be unexpected, so it is recommended to always use it. 🫢
  • wxTR_HIDE_ROOT β€” Use this style to suppress the display of the root node, effectively causing the first-level nodes to appear as a series of root nodes.
  • wxTR_ROW_LINES β€” Use this style to draw a contrasting border between displayed rows.
  • wxTR_HAS_VARIABLE_ROW_HEIGHT β€” Use this style to cause row heights to be just big enough to fit the content. If not set, all rows use the largest row height. The default is that this flag is unset. Generic only.
  • wxTR_SINGLE β€” For convenience to document that only one item may be selected at a time. Selecting another item causes the current selection, if any, to be deselected. This is the default. one at a time bestie, monogamy era πŸ’€
  • wxTR_MULTIPLE β€” Use this style to allow a range of items to be selected. If a second range is selected, the current range, if any, is deselected.
  • wxTR_DEFAULT_STYLE β€” The set of flags that are closest to the defaults for the native control for a particular toolkit.

See also overview_windowstyles.

Win32 notes:

wxTreeCtrl class uses the standard common treeview control under Win32 implemented in the system library comctl32.dll. Some versions of this library are known to have bugs with handling the tree control colours: the usual symptom is that the expanded items leave black (or otherwise incorrectly coloured) background behind them, especially for the controls using non-default background colour. The recommended solution is to upgrade the comctl32.dll to a newer version: see http://www.microsoft.com/downloads/details.aspx?familyid=cb2cf3a2-8025-4e8f-8511-9b476a8d35d2 😭 not the download link era

See:

  • wxTreeEvent
  • Overview treectrl
  • wxListBox
  • wxListCtrl
  • wxImageList

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

  • wxControl
  • wxWindow
  • wxEvtHandler

wxWidgets docs: wxTreeCtrl πŸŽ€

🌈 Events 🌈

Event types emitted from this class β€” the whole roster, no skips:

  • command_tree_begin_drag
  • command_tree_begin_rdrag
  • command_tree_end_drag
  • command_tree_begin_label_edit
  • command_tree_end_label_edit
  • command_tree_delete_item
  • command_tree_get_info
  • command_tree_set_info
  • command_tree_item_activated
  • command_tree_item_collapsed
  • command_tree_item_collapsing
  • command_tree_item_expanded
  • command_tree_item_expanding
  • command_tree_item_right_click
  • command_tree_item_middle_click
  • command_tree_sel_changed
  • command_tree_sel_changing
  • command_tree_key_down
  • command_tree_item_gettooltip
  • command_tree_item_menu
  • command_tree_state_image_click

🧚 DATA TYPES 🧚

wxTreeCtrl() :: wx:wx_object().

that's it. that's the type. iconic minimalism ✨


πŸ‘‘ FUNCTIONS πŸ‘‘

πŸ’œ addRoot

addRoot(This, Text, [Option]) -> integer()
                 when
                     This :: wxTreeCtrl(),
                     Text :: unicode:chardata(),
                     Option ::
                         {image, integer()} |
                         {selectedImage, integer()} |
                         {data, term()}.

Adds the root node to the tree, returning the new item. 🌱 main character gets to be first fr fr

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items ✨

πŸ’œ appendItem

appendItem(This, Parent, Text, [Option]) -> integer()
                    when
                        This :: wxTreeCtrl(),
                        Parent :: integer(),
                        Text :: unicode:chardata(),
                        Option ::
                            {image, integer()} |
                            {selectedImage, integer()} |
                            {data, term()}.

Appends an item to the end of the branch identified by parent, return a new item id. πŸŽ€

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items ✨

πŸ’œ assignImageList

assignImageList(This, ImageList) -> ok
                             when
                                 This :: wxTreeCtrl(),
                                 ImageList :: wxImageList:wxImageList().

Sets the normal image list.

The image list assigned with this method will be automatically deleted by wxTreeCtrl as appropriate (i.e. it takes ownership of the list). πŸ‘‘ it's literally the parent now

See: setImageList/2

πŸ’œ assignStateImageList

assignStateImageList(This, ImageList) -> ok
                                  when
                                      This :: wxTreeCtrl(),
                                      ImageList ::
wxImageList:wxImageList().

Sets the state image list.

Image list assigned with this method will be automatically deleted by wxTreeCtrl as appropriate (i.e. it takes ownership of the list). 🫢

See: setStateImageList/2

πŸ’œ collapse

collapse(This, Item) -> ok
                      when This :: wxTreeCtrl(), Item :: integer().

Collapses the given item. πŸ™ˆ closing that tab energy

πŸ’œ collapseAndReset

collapseAndReset(This, Item) -> ok
                              when This :: wxTreeCtrl(), Item :: integer().

Collapses the given item and removes all children. πŸ’€ not just hiding, actively clearing house

πŸ’œ create

create(This, Parent, [Option]) -> boolean()
                    when
                        This :: wxTreeCtrl(),
                        Parent :: wxWindow:wxWindow(),
                        Option ::
                            {id, integer()} |
                            {pos, {X :: integer(), Y :: integer()}} |
                            {size, {W :: integer(), H :: integer()}} |
                            {style, integer()} |
                            {validator, wx:wx_object()}.

Creates the tree control. 🌳✨

See new/2 for further details.

πŸ’œ delete

delete(This, Item) -> ok
                    when This :: wxTreeCtrl(), Item :: integer().

Deletes the specified item.

A EVT_TREE_DELETE_ITEM event will be generated.

This function may cause a subsequent call to getNextChild/3 to fail. ⚠️ be careful bestie

πŸ’œ deleteAllItems

deleteAllItems(This) -> ok when This :: wxTreeCtrl().

Deletes all items in the control.

This function generates wxEVT_TREE_DELETE_ITEM events for each item being deleted, including the root one if it is shown, i.e. unless wxTR_HIDE_ROOT style is used. πŸ’…

πŸ’œ deleteChildren

deleteChildren(This, Item) -> ok
                            when This :: wxTreeCtrl(), Item :: integer().

Deletes all children of the given item (but not the item itself). πŸ™ˆ the parent stays, the kids go

A wxEVT_TREE_DELETE_ITEM event will be generated for every item being deleted.

If you have called setItemHasChildren/3, you may need to call it again since deleteChildren/2 does not automatically clear the setting. πŸ‘€ lowkey sneaky

πŸ’œ destroy

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

Destroys the object πŸ’€ periodt

πŸ’œ editLabel

editLabel(This, Item) -> wxTextCtrl:wxTextCtrl()
                       when This :: wxTreeCtrl(), Item :: integer().

Starts editing the label of the given item. ✍️

This function generates a EVT_TREE_BEGIN_LABEL_EDIT event which can be vetoed so that no text control will appear for in-place editing.

If the user changed the label (i.e. s/he does not press ESC or leave the text control without changes, a EVT_TREE_END_LABEL_EDIT event will be sent which can be vetoed as well.

See: wxTreeEvent

πŸ’œ ensureVisible

ensureVisible(This, Item) -> ok
                           when This :: wxTreeCtrl(), Item :: integer().

Scrolls and/or expands items to ensure that the given item is visible. πŸ”­

This method can be used, and will work, even while the window is frozen (see wxWindow:freeze/1). ❄️ iconic behaviour honestly

πŸ’œ expand

expand(This, Item) -> ok
                    when This :: wxTreeCtrl(), Item :: integer().

Expands the given item. 🌸

πŸ’œ getBoundingRect

getBoundingRect(This, Item, [Option]) -> Result
                             when
                                 Result ::
                                     {Res :: boolean(),
                                      Rect ::
                                          {X :: integer(),
                                           Y :: integer(),
                                           W :: integer(),
                                           H :: integer()}},
                                 This :: wxTreeCtrl(),
                                 Item :: integer(),
                                 Option :: {textOnly, boolean()}.

Retrieves the rectangle bounding the item. πŸ“


✨ more parts incoming, don't go anywhere bestie 🫢

If textOnly is true, only the rectangle around the item's label will be returned, otherwise the item's image is also taken into account. πŸŽ€

The return value is true if the rectangle was successfully retrieved or false if it was not (in this case rect is not changed) β€” for example, if the item is currently invisible. rip, no rect for you 😭

Notice that the rectangle coordinates are logical, not physical ones. So, for example, the x coordinate may be negative if the tree has a horizontal scrollbar and its position is not 0. lowkey trippy but that's just how it is πŸ’…


getChildrenCount 🧚

getChildrenCount(This, Item, [Option]) -> integer()
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Option :: {recursively, boolean()}.

Returns the number of items in the branch. ✨

If recursively is true, it hands you the total number of descendants; otherwise only one level of children gets counted. no cap, just one layer bestie


getCount πŸ”’

getCount(This) -> integer() when This :: wxTreeCtrl().

Returns the number of items in the control. That's it, that's the whole thing, iconic behavior honestly πŸ’–


getEditControl ✏️

getEditControl(This) -> wxTextCtrl:wxTextCtrl()
    when This :: wxTreeCtrl().

Returns the edit control being currently used to edit a label. πŸ‘‘

Returns NULL if no label is being edited.

Note: This is currently only implemented for wxMSW.

getFirstChild πŸ“

getFirstChild(This, Item) -> Result
    when
        Result :: {Res :: integer(), Cookie :: integer()},
        This :: wxTreeCtrl(),
        Item :: integer().

Returns the first child; call getNextChild/3 for the next child. 🌈

For this enumeration function you must pass in a 'cookie' parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). The cookie passed to getFirstChild/2 and getNextChild/3 should be the same variable. don't mix up ur cookies pls πŸ™ˆ

Returns an invalid tree item (i.e. wxTreeItemId::IsOk() (not implemented in wx) returns false) if there are no further children.

See:

  • getNextChild/3
  • getNextSibling/2

getFirstVisibleItem πŸ‘€

getFirstVisibleItem(This) -> integer() when This :: wxTreeCtrl().

Returns the first visible item. vibe check passed, it's right there at the top


getImageList πŸ–ΌοΈ

getImageList(This) -> wxImageList:wxImageList()
    when This :: wxTreeCtrl().

Returns the normal image list. ✨


getIndent πŸ“

getIndent(This) -> integer() when This :: wxTreeCtrl().

Returns the current tree control indentation. yes bestie, the lil' indent situation


getItemBackgroundColour 🎨

getItemBackgroundColour(This, Item) -> wx:wx_colour4()
    when
        This :: wxTreeCtrl(),
        Item :: integer().

Returns the background colour of the item. 🌸


getItemData πŸ“¦

getItemData(This, Item) -> term()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the tree item data associated with the item. the lil' payload u snuck in there


getItemFont πŸ”€

getItemFont(This, Item) -> wxFont:wxFont()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the font of the item label. πŸ’–

If the font hadn't been explicitly set for the specified item with setItemFont/3, returns an invalid ?wxNullFont font. wxWindow:getFont/1 can be used to retrieve the global tree control font used for the items without any specific font. iykyk


getItemImage 🌟

getItemImage(This, Item, [Option]) -> integer()
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Option :: {which, wx:wx_enum()}.

Gets the specified item image. ✨

The value of which may be:

  • ?wxTreeItemIcon_Normal β€” to get the normal item image.
  • ?wxTreeItemIcon_Selected β€” to get the selected item image (i.e. the image which is shown when the item is currently selected).
  • ?wxTreeItemIcon_Expanded β€” to get the expanded image (this only makes sense for items which have children β€” then this image is shown when the item is expanded and the normal image is shown when it is collapsed).
  • ?wxTreeItemIcon_SelectedExpanded β€” to get the selected expanded image (which is shown when an expanded item is currently selected).

getItemParent πŸ‘†

getItemParent(This, Item) -> integer()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the item's parent. ur tree's mom fr fr


getItemText πŸ“

getItemText(This, Item) -> unicode:charlist()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the item label. πŸ’…


getItemTextColour 🌈

getItemTextColour(This, Item) -> wx:wx_colour4()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the colour of the item label. πŸŽ€


getLastChild 🧸

getLastChild(This, Item) -> integer()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the last child of the item (or an invalid tree item if this item has no children). 😭

See:

  • getFirstChild/2
  • getNextSibling/2
  • getLastChild/2

getNextChild πŸ¦‹

getNextChild(This, Item, Cookie) -> Result
    when
        Result :: {Res :: integer(), Cookie :: integer()},
        This :: wxTreeCtrl(),
        Item :: integer(),
        Cookie :: integer().

Returns the next child; call getFirstChild/2 for the first child. ✨

For this enumeration function you must pass in a 'cookie' parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). The cookie passed to getFirstChild/2 and getNextChild/3 should be the same. pls keep ur cookies straight πŸͺ

Returns an invalid tree item if there are no further children.

See: getFirstChild/2


getNextSibling ➑️

getNextSibling(This, Item) -> integer()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the next sibling of the specified item; call getPrevSibling/2 for the previous sibling. 🌸

Returns an invalid tree item if there are no further siblings.

See: getPrevSibling/2


getNextVisible πŸ”½

getNextVisible(This, Item) -> integer()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the next visible item or an invalid item if this item is the last visible one. πŸ’–

Note: The item itself must be visible.

getPrevSibling ⬅️

getPrevSibling(This, Item) -> integer()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the previous sibling of the specified item; call getNextSibling/2 for the next sibling. πŸŽ€

Returns an invalid tree item if there are no further children.

See: getNextSibling/2


getPrevVisible πŸ”Ό

getPrevVisible(This, Item) -> integer()
    when This :: wxTreeCtrl(), Item :: integer().

Returns the previous visible item or an invalid item if this item is the first visible one. πŸ‘‘

Note: The item itself must be visible.

getRootItem 🌳

getRootItem(This) -> integer() when This :: wxTreeCtrl().

Returns the root item for the tree control. the main character of ur tree πŸ’…


getSelection βœ…

getSelection(This) -> integer() when This :: wxTreeCtrl().

Returns the selection, or an invalid item if there is no selection. 😭

This function only works with the controls without wxTR_MULTIPLE style, use getSelections/1 for the controls which do have this style or, if a single item is wanted, use GetFocusedItem() (not implemented in wx). ok so pick ur fighter based on ur style bestie


getSelections πŸ’―

getSelections(This) -> Result
    when
        Result :: {Res :: integer(), Selection :: [integer()]},
        This :: wxTreeCtrl().

Fills the array of tree items passed in with the currently selected items. ✨

This function can be called only if the control has the wxTR_MULTIPLE style. 🚨

Returns the number of selected items.


getStateImageList 🌈

getStateImageList(This) -> wxImageList:wxImageList()
    when This :: wxTreeCtrl().

Returns the state image list (from which application-defined state images are taken). πŸŽ€


hitTest 🎯

hitTest(This, Point) -> Result
    when
        Result :: {Res :: integer(), Flags :: integer()},
        This :: wxTreeCtrl(),
        Point :: {X :: integer(), Y :: integer()}.

Calculates which (if any) item is under the given point, returning the tree item id at this point plus extra information flags. peekaboo bestie, who's at that pixel πŸ’–

flags is a bitlist of the following:

  • wxTREE_HITTEST_ABOVE β€” Above the client area.
  • wxTREE_HITTEST_BELOW β€” Below the client area.
  • wxTREE_HITTEST_NOWHERE β€” In the client area but below the last item.
  • wxTREE_HITTEST_ONITEMBUTTON β€” On the button associated with an item.
  • wxTREE_HITTEST_ONITEMICON β€” On the bitmap associated with an item.
  • wxTREE_HITTEST_ONITEMINDENT β€” In the indentation associated with an item.
  • wxTREE_HITTEST_ONITEMLABEL β€” On the label (string) associated with an item.
  • wxTREE_HITTEST_ONITEMRIGHT β€” In the area to the right of an item.
  • wxTREE_HITTEST_ONITEMSTATEICON β€” On the state icon for a tree view item that is in a user-defined state.
  • wxTREE_HITTEST_TOLEFT β€” To the right of the client area.
  • wxTREE_HITTEST_TORIGHT β€” To the left of the client area.

insertItem 🌱

insertItem(This, Parent, Previous, Text, [Option]) -> integer()
    when
        This :: wxTreeCtrl(),
        Parent :: integer(),
        Previous :: integer(),
        Text :: unicode:chardata(),
        Option ::
            {image, integer()} |
            {selImage, integer()} |
            {data, term()}.

Inserts an item after a given one (previous). 🫢

The image and selImage parameters are an index within the normal image list, and they say which pic to use for unselected and selected items respectively πŸ’–. And if image > -1 while selImage is -1, then bestie, the same image gets used for both selected and unselected items. One look, two moods πŸ’….


isBold/2

isBold(This, Item) -> boolean()
       when This :: wxTreeCtrl(), Item :: integer().

Returns true if the given item is living its bold era ✨.

See: setItemBold/3

isExpanded/2

isExpanded(This, Item) -> boolean()
           when This :: wxTreeCtrl(), Item :: integer().

Returns true if the item is expanded β€” and ngl this only makes sense if it actually has children 🧚.

isSelected/2

isSelected(This, Item) -> boolean()
           when This :: wxTreeCtrl(), Item :: integer().

Returns true if the item is selected. That's it, that's the whole vibe check πŸ’….

isTreeItemIdOk/1

isTreeItemIdOk(Item) -> boolean() when Item :: integer().

Returns true if the item is valid. Basically the "are you real or are you a ghost" check πŸ‘».

isVisible/2

isVisible(This, Item) -> boolean()
          when This :: wxTreeCtrl(), Item :: integer().

Returns true if the item is visible on the screen β€” like, actually on screen, not just lurking in the scrollback 🌸.

itemHasChildren/2

itemHasChildren(This, Item) -> boolean()
                when This :: wxTreeCtrl(), Item :: integer().

Returns true if the item has children 🫢.

new/0

new() -> wxTreeCtrl().

Default Constructor. Blank-slate queen, no options, no drama πŸ‘‘.

new/2

new(Parent, [Option]) -> wxTreeCtrl()
    when
        Parent :: wxWindow:wxWindow(),
        Option ::
            {id, integer()} |
            {pos, {X :: integer(), Y :: integer()}} |
            {size, {W :: integer(), H :: integer()}} |
            {style, integer()} |
            {validator, wx:wx_object()}.

Constructor, creating and showing a tree control β€” it makes it and it manifests it into existence, periodt ✨.

See: create/3

prependItem/4

prependItem(This, Parent, Text, [Option]) -> integer()
    when
        This :: wxTreeCtrl(),
        Parent :: integer(),
        Text :: unicode:chardata(),
        Option ::
            {image, integer()} |
            {selectedImage, integer()} |
            {data, term()}.

Appends an item as the first child of parent, and returns a new item id πŸŽ€. (yes, it says appends β€” that's what the doc says, and we are simply relaying the lore, no notes πŸ“)

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items πŸ’–.

scrollTo/2

scrollTo(This, Item) -> ok
         when This :: wxTreeCtrl(), Item :: integer().

Scrolls the specified item into view β€” bringing it to the front of the group chat, so to speak 🌈.

Heads up bestie: this method does not work while the window is frozen (See wxWindow:freeze/1), at least under MSW 😭.

See: ensureVisible/2

selectItem/3

selectItem(This, Item, [Option]) -> ok
           when
               This :: wxTreeCtrl(),
               Item :: integer(),
               Option :: {select, boolean()}.

Selects the given item ✨.

In multiple selection controls, it can also be used to deselect a currently selected item if the value of select is false πŸ’….

Notice that calling this method will generate wxEVT_TREE_SEL_CHANGING and wxEVT_TREE_SEL_CHANGED events, and that the change could be vetoed by the former event handler. So like, the first event has veto power πŸ›‘.

setImageList/2

setImageList(This, ImageList) -> ok
             when
                 This :: wxTreeCtrl(),
                 ImageList :: wxImageList:wxImageList().

Sets the normal image list πŸ–ΌοΈ.

The image list assigned with this method will not be deleted by wxTreeCtrl's destructor β€” you must delete it yourself. No one is cleaning that up for you, bestie πŸ’€.

See: assignImageList/2

setIndent/2

setIndent(This, Indent) -> ok
          when This :: wxTreeCtrl(), Indent :: integer().

Sets the indentation for the tree control. Structural gorgeousness, controlled πŸŽ€.

setItemBackgroundColour/3

setItemBackgroundColour(This, Item, Col) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Col :: wx:wx_colour().

Sets the colour of the item's background 🌸.

setItemBold/3

setItemBold(This, Item, [Option]) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Option :: {bold, boolean()}.

Makes item appear in bold font if the bold parameter is true, or resets it to the normal state ✨. Bold era on, bold era off.

See: isBold/2

setItemData/3

setItemData(This, Item, Data) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Data :: term().

Sets the item client data πŸ“.

Notice that the client data previously associated with the item (if any) is not freed by this function, and so calling this function multiple times for the same item will result in memory leaks unless you delete the old item data pointer yourself. This is the part where you handle your own business, fr fr 😭.

setItemDropHighlight/3

setItemDropHighlight(This, Item, [Option]) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Option :: {highlight, boolean()}.

Gives the item the visual feedback for Drag'n'Drop actions ✨, which is useful if something is dragged from the outside onto the tree control β€” as opposed to a DnD operation within the tree control, which already is implemented internally. Outside drag = you do the sparkle yourself πŸ’….

setItemFont/3

setItemFont(This, Item, Font) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Font :: wxFont:wxFont().

Sets the item's font πŸŽ€.

All items in the tree should have the same height to avoid text clipping, so the font height should be the same for all of them, although font attributes may vary. Same height, different personalities πŸ¦‹.

See: setItemBold/3

setItemHasChildren/3

setItemHasChildren(This, Item, [Option]) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Option :: {has, boolean()}.

Force appearance of the button next to the item πŸ‘€.

This is useful to allow the user to expand the items which don't have any children now, but instead adding them only when needed β€” thus minimizing memory usage and loading time. Lazy-loading, but make it cute 🌈.

setItemImage/4

setItemImage(This, Item, Image, [Option]) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Image :: integer(),
        Option :: {which, wx:wx_enum()}.

Sets the specified item's image πŸ–ΌοΈ.

See getItemImage/3 for the description of the which parameter (go read that one, bestie, it's got the details πŸ“–).

setItemText/3

setItemText(This, Item, Text) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Text :: unicode:chardata().

Sets the item label ✨. The text. The name. The whole identity of the item πŸ’….

setItemTextColour/3

setItemTextColour(This, Item, Col) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer(),
        Col :: wx:wx_colour().

Sets the colour of the item's text 🌸.

setStateImageList/2

setStateImageList(This, ImageList) -> ok
    when
        This :: wxTreeCtrl(),
        ImageList :: wxImageList:wxImageList().

Sets the state image list β€” the one from which application-defined state images are taken 🌟.

Image list assigned with this method will not be deleted by wxTreeCtrl's destructor β€” you must delete it yourself. Same energy as setImageList/2: your list, your cleanup 😀.

See: assignStateImageList/2

setWindowStyle/2

setWindowStyle(This, Styles) -> ok
    when This :: wxTreeCtrl(), Styles :: integer().

Sets the mode flags associated with the display of the tree control 🎚️.

The new mode takes effect immediately ⚑.

Note: Generic only; MSW ignores changes. MSW is not listening to you on this one, bestie πŸ™ˆ.

sortChildren/2

sortChildren(This, Item) -> ok
    when This :: wxTreeCtrl(), Item :: integer().

Sorts the children of the given item using OnCompareItems() (not implemented in wx) πŸ“š.

You should override that method to change the sort order β€” the default is ascending case-sensitive alphabetical order πŸ”€.

toggle/2

toggle(This, Item) -> ok
    when This :: wxTreeCtrl(), Item :: integer().

Toggles the given item between collapsed and expanded states πŸͺ—. Fold, unfold, fold, unfold β€” accordion behaviour, iconic.

toggleItemSelection/2

toggleItemSelection(This, Item) -> ok
    when
        This :: wxTreeCtrl(),
        Item :: integer().

Toggles the given item between selected and unselected states ✨.

For multiselection controls only πŸ‘‘.

unselect/1

unselect(This) -> ok when This :: wxTreeCtrl().

Removes the selection from the currently selected item (if any) πŸ’….

unselectAll/1

unselectAll(This) -> ok when This :: wxTreeCtrl().

This function either behaves the same as unselect/1 if the control doesn't have wxTR_MULTIPLE style, or removes the selection from all items if it does have this style 🌈. Depends on the style, diva.

unselectItem/2

unselectItem(This, Item) -> ok
    when This :: wxTreeCtrl(), Item :: integer().

Unselects the given item ✨.

This works in multiselection controls only 🫢.


And that's a wrap on the whole page, bestie!! πŸŒΈπŸŽ€ This gorgeous masterpiece came to you courtesy of Ericsson AB, from the wx 2.6 era, filed under <code>wxTreeCtrl(3)</code> β€” go build something iconic with it, you absolute Unix main character πŸ‘‘πŸ’–βœ¨

πŸ“¦ where this page comes from