wxListCtrl(3)

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

πŸ’– wxListCtrl(3) πŸ’–

(Erlang Module Definition)

✨ NAME ✨

wxListCtrl β€” A list control presents lists in a number of formats: list view, report view, icon view and small icon view.

🌸 DESCRIPTION 🌸

okay so bestie, here's the tea: in any case, elements are numbered from zero. For all these modes, the items are stored in the control and must be added to it using insertItem/4 method. no cap.

A special case of report view quite different from the other modes of the list control is a virtual control in which the items data (including text, images and attributes) is managed by the main program and is requested by the control itself only when needed which allows having controls with millions of items without consuming much memory. To use virtual list control you must use setItemCount/2 first and override at least wxListCtrl::OnGetItemText (not implemented in wx) (and optionally wxListCtrl::OnGetItemImage (not implemented in wx) or wxListCtrl::OnGetItemColumnImage (not implemented in wx) and wxListCtrl::OnGetItemAttr (not implemented in wx)) to return the information about the items when the control requests it. it's giving main character energy.

Virtual list control can be used as a normal one except that no operations which can take time proportional to the number of items in the control happen - this is required to allow having a practically infinite number of items. For example, in a multiple selection virtual list control, the selections won't be sent when many items are selected at once because this could mean iterating over all the items. lowkey wild.

Using many of wxListCtrl features is shown in the corresponding sample. ✨

To intercept events from a list control, use the event table macros described in wxListEvent. iykyk.

wxMac Note: Starting with wxWidgets 2.8, wxListCtrl uses a native implementation for report mode, and uses a generic implementation for other modes. You can use the generic implementation for report mode as well by setting the mac.listctrl.always_use_generic system option (see wxSystemOptions) to 1.

πŸŽ€ Styles πŸŽ€

This class supports the following styles, and they're all kind of iconic:

  • wxLC_LIST β€” Multicolumn list view, with optional small icons. Columns are computed automatically, i.e. you don't set columns as in wxLC_REPORT. In other words, the list wraps, unlike a wxListBox.
  • wxLC_REPORT β€” Single or multicolumn report view, with optional header.
  • wxLC_VIRTUAL β€” The application provides items text on demand. May only be used with wxLC_REPORT.
  • wxLC_ICON β€” Large icon view, with optional labels.
  • wxLC_SMALL_ICON β€” Small icon view, with optional labels.
  • wxLC_ALIGN_TOP β€” Icons align to the top. Win32 default, Win32 only.
  • wxLC_ALIGN_LEFT β€” Icons align to the left.
  • wxLC_AUTOARRANGE β€” Icons arrange themselves. Win32 only.
  • wxLC_EDIT_LABELS β€” Labels are editable: the application will be notified when editing starts.
  • wxLC_NO_HEADER β€” No header in report mode.
  • wxLC_SINGLE_SEL β€” Single selection (default is multiple).
  • wxLC_SORT_ASCENDING β€” Sort in ascending order. (You must still supply a comparison callback in sortItems/2.)
  • wxLC_SORT_DESCENDING β€” Sort in descending order. (You must still supply a comparison callback in sortItems/2.)
  • wxLC_HRULES β€” Draws light horizontal rules between rows in report mode.
  • wxLC_VRULES β€” Draws light vertical rules between columns in report mode.

πŸ” See: πŸ”

  • Overview listctrl
  • wxListView
  • wxListBox
  • wxTreeCtrl
  • wxImageList
  • wxListEvent
  • wxListItem

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

  • wxControl
  • wxWindow
  • wxEvtHandler

wxWidgets docs: wxListCtrl

πŸ’… Events πŸ’…

Event types emitted from this class, periodt:

  • command_list_begin_drag
  • command_list_begin_rdrag
  • command_list_begin_label_edit
  • command_list_end_label_edit
  • command_list_delete_item
  • command_list_delete_all_items
  • command_list_item_selected
  • command_list_item_deselected
  • command_list_item_activated
  • command_list_item_focused
  • command_list_item_middle_click
  • command_list_item_right_click
  • command_list_key_down
  • command_list_insert_item
  • command_list_col_click
  • command_list_col_right_click
  • command_list_col_begin_drag
  • command_list_col_dragging
  • command_list_col_end_drag
  • command_list_cache_hint

πŸ¦‹ DATA TYPES πŸ¦‹

wxListCtrl() :: wx:wx_object().

πŸ‘‘ FUNCTIONS πŸ‘‘

arrange/2

arrange(This, [Option]) -> boolean()
                 when This :: wxListCtrl(), Option :: {flag, integer()}.

Arranges the items in icon or small icon view.

This only has effect on Win32. flag is one of:

  • wxLIST_ALIGN_DEFAULT β€” Default alignment.
  • wxLIST_ALIGN_LEFT β€” Align to the left side of the control.
  • wxLIST_ALIGN_TOP β€” Align to the top side of the control.
  • wxLIST_ALIGN_SNAP_TO_GRID β€” Snap to grid.

assignImageList/3

assignImageList(This, ImageList, Which) -> ok
                         when
                             This :: wxListCtrl(),
                             ImageList :: wxImageList:wxImageList(),
                             Which :: integer().

Sets the image list associated with the control and takes ownership of it (i.e. the control will, unlike when using setImageList/3, delete the list when destroyed). which is one of wxIMAGE_LIST_NORMAL, wxIMAGE_LIST_SMALL, wxIMAGE_LIST_STATE (the last is unimplemented).

See: setImageList/3

clearAll/1

clearAll(This) -> ok when This :: wxListCtrl().

Deletes all items and all columns.

Note: This sends an event of type wxEVT_LIST_DELETE_ALL_ITEMS under all platforms.

deleteAllItems/1

deleteAllItems(This) -> boolean() when This :: wxListCtrl().

Deletes all items in the list control.

This function does not send the wxEVT_LIST_DELETE_ITEM event because deleting many items from the control would be too slow then (unlike deleteItem/2) but it does send the special wxEVT_LIST_DELETE_ALL_ITEMS event if the control was not empty. If it was already empty, nothing is done and no event is sent.

Return: true if the items were successfully deleted or if the control was already empty, false if an error occurred while deleting the items.

deleteColumn/2

deleteColumn(This, Col) -> boolean()
                      when This :: wxListCtrl(), Col :: integer().

Deletes a column.

deleteItem/2

deleteItem(This, Item) -> boolean()
                    when This :: wxListCtrl(), Item :: integer().

Deletes the specified item.

This function sends the wxEVT_LIST_DELETE_ITEM event for the item being deleted.

See: deleteAllItems/1

destroy/1

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

Destroys the object

editLabel/2

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

Starts editing the label of the given item.

This function generates a EVT_LIST_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_LIST_END_LABEL_EDIT event will be sent which can be vetoed as well.

ensureVisible/2

ensureVisible(This, Item) -> boolean()
                       when This :: wxListCtrl(), Item :: integer().

Ensures this item is visible.

findItem/4 and findItem/5

findItem(This, Start, Str, [Option]) -> integer()
                  when
                      This :: wxListCtrl(),
                      Start :: integer(),
                      Str :: unicode:chardata(),
                      Option :: {partial, boolean()};
              (This, Start, Pt, Direction) -> integer()
                  when
                      This :: wxListCtrl(),
                      Start :: integer(),
                      Pt :: {X :: integer(), Y :: integer()},
                      Direction :: integer().

Find an item nearest this position in the specified direction, starting from start or the beginning if start is -1.

Return: The next matching item if any or -1 (wxNOT_FOUND) otherwise.

getColumn/3

getColumn(This, Col, Item) -> boolean()
                   when
                       This :: wxListCtrl(),
                       Col :: integer(),
                       Item :: wxListItem:wxListItem().

Gets information about this column.

See setItem/5 for more information.

getColumnCount/1

getColumnCount(This) -> integer() when This :: wxListCtrl().

Returns the number of columns.

getColumnWidth/2

getColumnWidth(This, Col) -> integer()
                        when This :: wxListCtrl(), Col :: integer().

Gets the column width (report view only).

getCountPerPage/1

getCountPerPage(This) -> integer() when This :: wxListCtrl().

Gets the number of items that can fit vertically in the visible area of the list control (list or report view) or the total number of items in the list control (icon or small icon view).

getEditControl/1

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

Returns the edit control being currently used to edit a label.

Returns NULL if no label is being edited.

Note: It is currently only implemented for wxMSW and the generic version, not for the native macOS version.

getImageList/2

getImageList(This, Which) -> wxImageList:wxImageList()
                      when This :: wxListCtrl(), Which :: integer().

Returns the specified image list.

which may be one of:

  • wxIMAGE_LIST_NORMAL β€” The normal (large icon) image list.
  • wxIMAGE_LIST_SMALL β€” The small icon image list.
  • wxIMAGE_LIST_STATE β€” The user-defined state image list (unimplemented).

getItem/2

getItem(This, Info) -> boolean()
                 when
                     This :: wxListCtrl(),
                     Info :: wxListItem:wxListItem().

Gets information about the item.

See setItem/5 for more information.

You must call info.SetId() to set the ID of item you're interested in before calling this method, and info.SetMask() with the flags indicating what fields you need to retrieve from info.

getItemBackgroundColour/2

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

Returns the colour for this item.


🫧 getItemCount

getItemCount(This) -> integer() when This :: wxListCtrl().

Tells you how many items are vibing in the list control. that's it, that's the whole function πŸ’–


πŸ“Œ getItemData

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

Grabs the application-defined data you stashed on this item. it's your data, you put it there, you know what it means ✨


πŸ”€ getItemFont

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

Hands you back the item's font. slay, typography.


πŸ“ getItemPosition

getItemPosition(This, Item) -> Result
                         when
                             Result ::
                                 {Res :: boolean(),
                                  Pos ::
                                      {X :: integer(), Y :: integer()}},
                             This :: wxListCtrl(),
                             Item :: integer().

Returns where the item is sitting β€” but only in icon or small icon view. in list or report view bestie, no position for you πŸ™ˆ


πŸ“ getItemRect

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

Returns the rectangle that represents the item's size and position, in physical coordinates. very demure, very mindful.

code is one of wxLIST_RECT_BOUNDS, wxLIST_RECT_ICON, wxLIST_RECT_LABEL. pick your fighter πŸ’…


πŸ“ getItemSpacing

getItemSpacing(This) -> {W :: integer(), H :: integer()}
                        when This :: wxListCtrl().

Retrieves the spacing between icons, in pixels. the horizontal spacing comes back as the x component of the {Width,Height} object, and the vertical spacing as its y component. so: x = sideways, y = up-down. iykyk πŸ¦‹


🚦 getItemState

getItemState(This, Item, StateMask) -> integer()
                      when
                          This :: wxListCtrl(),
                          Item :: integer(),
                          StateMask :: integer().

Gets the item state. for the full menu of state flags, go peek at setItem/5 β€” and StateMask is you telling it which state flags you actually care about πŸ‘‘


πŸ“ getItemText

getItemText(This, Item, [Option]) -> unicode:charlist()
                     when
                         This :: wxListCtrl(),
                         Item :: integer(),
                         Option :: {col, integer()}.

Gets the item text for this item. the col option? that's your column, bestie 🌸


🎨 getItemTextColour

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

Returns the colour for this item.

Heads up though β€” if the item has no specific colour, you get back an invalid colour, and NOT the default foreground control of the control itself. why? bc that would make it impossible to tell apart items that share the same colour as the current control foreground from items with default colour, which hence always have the same colour as the control. iconic logic, no notes.

See also: getItemTextColour/2.


πŸ” getNextItem

getNextItem(This, Item, [Option]) -> integer()
                         when
                             This :: wxListCtrl(),
                             Item :: integer(),
                             Option ::
                                 {geometry, integer()} | {state, integer()}.

Searches for an item with the given geometry or state, starting from item but excluding the item itself β€” no self-searching in this house.

If item is -1, the first item that matches the specified flags will be returned. Returns the first item with the given state following item, or -1 if no such item was found. This function may be used to find all selected items in the control like this:

(lowkey the example is just implied here, bestie β€” the manpage says "like this:" and lets you fill in the blank 😭)

geometry can be one of:

  • wxLIST_NEXT_ABOVE: searches for an item above the specified item.
  • wxLIST_NEXT_ALL: searches for subsequent item by index.
  • wxLIST_NEXT_BELOW: searches for an item below the specified item.
  • wxLIST_NEXT_LEFT: searches for an item to the left of the specified item.
  • wxLIST_NEXT_RIGHT: searches for an item to the right of the specified item.
Note: this parameter is only supported by wxMSW currently and ignored on other platforms. so, like, if you're not on wxMSW, geometry is not your moment πŸ’€

state can be a bitlist of the following:

  • wxLIST_STATE_DONTCARE: don't care what the state is. (the chill one)
  • wxLIST_STATE_DROPHILITED: the item indicates it is a drop target.
  • wxLIST_STATE_FOCUSED: the item has the focus. main character energy πŸ‘‘
  • wxLIST_STATE_SELECTED: the item is selected.
  • wxLIST_STATE_CUT: the item is selected as part of a cut and paste operation. βœ‚οΈ

βœ… getSelectedItemCount

getSelectedItemCount(This) -> integer() when This :: wxListCtrl().

Returns how many items in the list control are currently selected. count your blessings, count your selections πŸŽ€


πŸ–οΈ getTextColour

getTextColour(This) -> wx:wx_colour4() when This :: wxListCtrl().

Gets the text colour of the list control. the whole control's, not one item's β€” don't get it twisted ✨


⬆️ getTopItem

getTopItem(This) -> integer() when This :: wxListCtrl().

Gets the index of the topmost visible item when you're in list or report view. peek-a-boo, you're the one at the top 🌈


πŸ–ΌοΈ getViewRect

getViewRect(This) ->
                 {X :: integer(),
                  Y :: integer(),
                  W :: integer(),
                  H :: integer()}
                 when This :: wxListCtrl().

Returns the rectangle taken by all items in the control.

In other words: if the control's client size were equal to the size of this rectangle, no scrollbars would be needed and no free space would be left. the perfect fit. the dream. πŸ’–

Note that this function only works in the icon and small icon views, not in list or report views (this is a limitation of the native Win32 control). rip, sorry bestie 😭

🎯 hitTest

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

Determines which item (if any) is at the specified point, and gives you the details in flags. detective work, but make it cute πŸ”

Returns the index of the item, or wxNOT_FOUND if no item is at the specified point.

flags will be a combination of the following:

  • wxLIST_HITTEST_ABOVE: above the control's client area.
  • wxLIST_HITTEST_BELOW: below the control's client area.
  • wxLIST_HITTEST_TOLEFT: to the left of the control's client area.
  • wxLIST_HITTEST_TORIGHT: to the right of the control's client area.
  • wxLIST_HITTEST_NOWHERE: inside the control's client area but not over an item.
  • wxLIST_HITTEST_ONITEMICON: over an item's icon.
  • wxLIST_HITTEST_ONITEMLABEL: over an item's text.
  • wxLIST_HITTEST_ONITEMSTATEICON: over the checkbox of an item. β˜‘οΈ
  • wxLIST_HITTEST_ONITEM: combination of wxLIST_HITTEST_ONITEMICON, wxLIST_HITTEST_ONITEMLABEL, wxLIST_HITTEST_ONITEMSTATEICON.

If ptrSubItem is not NULL and the wxListCtrl is in the report mode, the subitem (or column) number will also be provided. This feature is only available in version 2.7.0 or higher, and is currently only implemented under wxMSW β€” and it requires at least comctl32.dll of version 4.70 on the host system, or the value stored in ptrSubItem will always be -1. To compile this feature into the wxWidgets library you need to have access to commctrl.h of version 4.70 that is provided by Microsoft. that's a whole lot of conditions, but okay, we respect the grind 🫢


βž• insertColumn

insertColumn(This, Col, Heading) -> integer()
                      when
                          This :: wxListCtrl(),
                          Col :: integer(),
                          Heading :: unicode:chardata();
                  (This, Col, Info) -> integer()
                      when
                          This :: wxListCtrl(),
                          Col :: integer(),
                          Info :: wxListItem:wxListItem().

For report view mode (only), inserts a column. report view girlies, this one's for you πŸ’…

For more details, see setItem/5. Also see the insertColumn/4 overload for a usually more convenient alternative to this method, plus the description of how the item width is interpreted by this method.


βž•βœ¨ insertColumn (with options)

insertColumn(This, Col, Heading, [Option]) -> integer()
                      when
                          This :: wxListCtrl(),
                          Col :: integer(),
                          Heading :: unicode:chardata(),
                          Option ::
                              {format, integer()} | {width, integer()}.

For report view mode (only), inserts a column.

Inserts a new column in the list control in report view mode at the given position, specifying its most common attributes. the usual suspects, all in one call πŸŽ€

Notice that to set the image for the column you need to use the insertColumn/4 overload and specify ?wxLIST_MASK_IMAGE in the item mask. so if you're wondering where the image went β€” it's over there, bestie.

Return: the index of the inserted column, or -1 if adding it failed. πŸ’”


πŸ†• insertItem

insertItem(This, Info) -> integer()
                    when
                        This :: wxListCtrl(),
                        Info :: wxListItem:wxListItem().

Inserts an item, returning the index of the new item if successful β€” and -1 otherwise. crossing my fingers for you fr fr 🀞


πŸ†• insertItem (by index)

insertItem(This, Index, ImageIndex) -> integer()
                    when
                        This :: wxListCtrl(),
                        Index :: integer(),
                        ImageIndex :: integer();
                (This, Index, Label) -> integer()
                    when
                        This :: wxListCtrl(),
                        Index :: integer(),
                        Label :: unicode:chardata().

Insert a string item. πŸ“


πŸ†• insertItem (image + label)

insertItem(This, Index, Label, ImageIndex) -> integer()
                    when
                        This :: wxListCtrl(),
                        Index :: integer(),
                        Label :: unicode:chardata(),
                        ImageIndex :: integer().

Insert an image/string item. the full combo, no crumbs 🌈


πŸ”„ refreshItem

refreshItem(This, Item) -> ok
                     when This :: wxListCtrl(), Item :: integer().

Redraws the given item. giving it a lil glow-up so it reflects reality again ✨

...and that's the whole tea on refreshItem/2: it's only useful for virtual list controls, because if you don't call it, the displayed value of the item literally does not change even when the underlying data does. So like, the vibe on screen is stale. πŸ‘»

See: refreshItems/3


refreshItems/3

refreshItems(This, ItemFrom, ItemTo) -> ok
    when
        This :: wxListCtrl(),
        ItemFrom :: integer(),
        ItemTo :: integer().

Redraws the items from ItemFrom to ItemTo. 🎨

The starting item has to be less than or equal to the ending one (obvi bestie, no time-travel redraws).

And just like refreshItem/2, this is only useful for virtual list controls. ✨


scrollList/3

scrollList(This, Dx, Dy) -> boolean()
    when
        This :: wxListCtrl(),
        Dx :: integer(),
        Dy :: integer().

Scrolls the list control. πŸ¦‹

The breakdown:

  • In icon, small icon or report view mode, Dx is the number of pixels to scroll.
  • In list view mode, Dx is the number of columns to scroll.
  • Dy always specifies the number of pixels to scroll vertically.
⚠️ Note: this method is currently only implemented in the Windows version. So on other platforms it's giving theoretical. πŸ’€

setBackgroundColour/2

setBackgroundColour(This, Col) -> boolean()
    when
        This :: wxListCtrl(),
        Col :: wx:wx_colour().

Sets the background colour. 🌈

Little heads-up: the wxWindow:getBackgroundColour/1 function of the wxWindow base class can be used to grab the current background colour, so you're not just setting and praying. πŸ’…


setColumn/3

setColumn(This, Col, Item) -> boolean()
    when
        This :: wxListCtrl(),
        Col :: integer(),
        Item :: wxListItem:wxListItem().

Sets information about this column. πŸ“‹

See setItem/5 for more info β€” same energy, different slot.


setColumnWidth/3

setColumnWidth(This, Col, Width) -> boolean()
    when
        This :: wxListCtrl(),
        Col :: integer(),
        Width :: integer().

Sets the column width. πŸ“

Width can be an actual width in pixels, or one of these two iconic little constants:

  • wxLIST_AUTOSIZE (-1) β€” resizes the column to the length of its longest item.
  • wxLIST_AUTOSIZE_USEHEADER (-2) β€” resizes the column to the length of the header (Win32) or 80 pixels (other platforms).

And if you're in small or normal icon view, Col must be -1, and the column width gets set for all columns. Every single one. πŸ‘‘


setImageList/3

setImageList(This, ImageList, Which) -> ok
    when
        This :: wxListCtrl(),
        ImageList :: wxImageList:wxImageList(),
        Which :: integer().

Sets the image list associated with the control. πŸ–ΌοΈ

Which is one of:

  • wxIMAGE_LIST_NORMAL
  • wxIMAGE_LIST_SMALL
  • wxIMAGE_LIST_STATE (the last one is unimplemented, so don't get attached βœ‹)
🚨 Real talk: this method does not take ownership of the image list. You have to delete it yourself, bestie. It's yours now.

See: assignImageList/3


setItem/2

setItem(This, Info) -> boolean()
    when
        This :: wxListCtrl(),
        Info :: wxListItem:wxListItem().

Sets the data of an item. πŸ’Ύ

Using the wxListItem's mask and state mask, you can change only selected attributes of a wxListCtrl item. Selective editing, we love her.

Return: true if the item was successfully updated, or false if the update failed for some reason (e.g. an invalid item index). 😭


setItem/5

setItem(This, Index, Column, Label, [Option]) -> boolean()
    when
        This :: wxListCtrl(),
        Index :: integer(),
        Column :: integer(),
        Label :: unicode:chardata(),
        Option :: {imageId, integer()}.

Sets an item string field at a particular column. ✍️

Option here is {imageId, integer()} if you wanna bring an image along.

Return: true if the item was successfully updated, or false if the update failed for some reason (e.g. an invalid item index). Same deal as above. πŸ™ˆ


setItemBackgroundColour/3

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

Sets the background colour for this item. πŸŽ€

This function only works in report view mode. The colour can be retrieved using getItemBackgroundColour/2.


setItemColumnImage/4

setItemColumnImage(This, Item, Column, Image) -> boolean()
    when
        This :: wxListCtrl(),
        Item :: integer(),
        Column :: integer(),
        Image :: integer().

Sets the image associated with the item. πŸ–ΌοΈ

In report view, you can specify the column. The image is an index into the image list associated with the list control β€” so it's a number, not the image itself, iykyk.


setItemCount/2

setItemCount(This, Count) -> ok
    when This :: wxListCtrl(), Count :: integer().

This method can only be used with virtual list controls. 🌸

It's used to tell the control the number of items it contains. After calling it, the main program should be ready to handle calls to various item callbacks (such as wxListCtrl::OnGetItemText (not implemented in wx)) for all items in the range from 0 to Count.

πŸ“Œ Notice: the control is not necessarily redrawn after this call, because it may be undesirable if an item which is not visible on the screen anyhow was added to or removed from a control displaying many items. If you do need to refresh the display, you can just call wxWindow:refresh/2 manually. You got this.

setItemData/3

setItemData(This, Item, Data) -> boolean()
    when
        This :: wxListCtrl(),
        Item :: integer(),
        Data :: integer().

Associates application-defined data with this item. πŸ”—

⚠️ Notice: this function cannot be used to associate pointers with the control items. Use SetItemPtrData() (not implemented in wx) instead. No pointer shenanigans here, bestie.

setItemFont/3

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

Sets the item's font. ✨ Font glow-up incoming.


setItemImage/4

setItemImage(This, Item, Image, [Option]) -> boolean()
    when
        This :: wxListCtrl(),
        Item :: integer(),
        Image :: integer(),
        Option :: {selImage, integer()}.

Sets the unselected and selected images associated with the item. Two looks, one item β€” main character energy. πŸ‘‘

The images are indices into the image list associated with the list control.

Option lets you pass {selImage, integer()} for the selected-state image.


setItemPosition/3

setItemPosition(This, Item, Pos) -> boolean()
    when
        This :: wxListCtrl(),
        Item :: integer(),
        Pos :: {X :: integer(), Y :: integer()}.

Sets the position of the item, in icon or small icon view. πŸ“

Windows only. πŸͺŸ


setItemState/4

setItemState(This, Item, State, StateMask) -> boolean()
    when
        This :: wxListCtrl(),
        Item :: integer(),
        State :: integer(),
        StateMask :: integer().

Sets the item state. πŸŽ›οΈ

The StateMask is a combination of wxLIST_STATE_XXX constants described in the wxListItem documentation. For each of the bits specified in StateMask, the corresponding state is set or cleared depending on whether the State argument contains the same bit or not.

So to select an item you can use while to deselect it you should use

(yep, that sentence is genuinely how it lands in the original β€” the snippet dipped out on us 😭)

πŸ’€ Consider using wxListView if possible to avoid dealing with this error-prone and confusing method. Genuinely, it's a lot.

Also notice that β€” contrary to the usual rule that only user actions generate events β€” this method does generate the wxEVT_LIST_ITEM_SELECTED event when it is used to select an item. Surprise event. πŸŽ‰


setItemText/3

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

Sets the item text for this item. ✍️ Simple, clean, slay.


setItemTextColour/3

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

Sets the colour for this item. 🎨

This function only works in report view. The colour can be retrieved using getItemTextColour/2.


setSingleStyle/3

setSingleStyle(This, Style, [Option]) -> ok
    when
        This :: wxListCtrl(),
        Style :: integer(),
        Option :: {add, boolean()}.

Adds or removes a single window style. 🧩

Option is {add, boolean()} β€” pass the boolean and control whether you're adding or removing.


setTextColour/2

setTextColour(This, Col) -> ok
    when This :: wxListCtrl(), Col :: wx:wx_colour().

Sets the text colour of the list control. 🌈 Whole control, one colour.


setWindowStyleFlag/2

setWindowStyleFlag(This, Style) -> ok
    when
        This :: wxListCtrl(), Style :: integer().

Sets the whole window style, deleting all items. πŸ’€

Yes bestie, all of them. That's not a typo, that's a warning β€” brace yourself before you call this one.


and that's the whole file, bestie!! 🫢 Thanks for sticking all the way to the end of wxListCtrl(3) β€” you absolutely ate. This page came to you from Ericsson AB, belongs to the wx 2.6 era, and lives at wxListCtrl(3). Go forth and list things, iconically. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from