wxGrid(3erl)

๐Ÿ“ฆ
version 25.3.2.8 ยท 5 versions
, in ubuntu noble

๐Ÿฆ‹ wxGrid(3erl) โ€” Erlang Module Definition ๐Ÿฆ‹

okay bestie, welcome to the wxGrid(3erl) page โ€” yes, the whole manual name is folded right up here at the top so we can get straight into the good stuff. This is the Erlang module definition for wxGrid, and it's lowkey a whole little ecosystem. ๐Ÿ’…


โœจ NAME โœจ

wxGrid โ€” Functions for wxGrid class. periodt. ๐ŸŽ€


๐Ÿ’– DESCRIPTION ๐Ÿ’–

okay so wxGrid and its related classes are literally built for displaying and editing tabular data. They come with a rich set of features for display, editing, and interacting with a variety of data sources. For simple applications โ€” and honestly to help you get started โ€” wxGrid is the only class you need to refer to directly. It will set up default instances of the other classes and manage them for you. No cap, it handles the little guys. ๐Ÿซถ

For more complex applications you can derive your own classes for custom grid views, grid data tables, cell editors and renderers. The overview_grid has examples of simple and more complex applications, explains the relationship between the various grid classes and has a summary of the keyboard shortcuts and mouse functions provided by wxGrid. iykyk, it's giving very useful overview energy. ๐ŸŒˆ

A wxGridTableBase (not implemented in wx) class holds the actual data to be displayed by a wxGrid class. One or more wxGrid classes may act as a view for one table class. The default table class is called wxGridStringTable (not implemented in wx) and holds an array of strings. An instance of such a class is created by createGrid/4. ๐Ÿ“

wxGridCellRenderer is the abstract base class for rendering contents in a cell. The following renderers are predefined:

The look of a cell can be further defined using wxGridCellAttr. An object of this type may be returned by wxGridTableBase::GetAttr() (not implemented in wx). โœจ

wxGridCellEditor is the abstract base class for editing the value of a cell. The following editors are predefined:

Please see wxGridEvent, wxGridSizeEvent (not implemented in wx), wxGridRangeSelectEvent (not implemented in wx), and wxGridEditorCreatedEvent (not implemented in wx) for the documentation of all event types you can use with wxGrid. ๐Ÿ’–

See: Overview grid, wxGridUpdateLocker (not implemented in wx)

This class is derived (and can use functions) from: wxScrolledWindow wxPanel wxWindow wxEvtHandler

wxWidgets docs: wxGrid ๐Ÿ‘‘


๐ŸŒธ DATA TYPES ๐ŸŒธ

wxGrid() = wx:wx_object()

๐Ÿ’… EXPORTS ๐Ÿ’…

okay bestie, here come the exports โ€” buckle up, there are a lot, and each one is doing its little thing. โœจ

new() -> wxGrid()

Default constructor. ๐ŸŽ€

You must call Create() (not implemented in wx) to really create the grid window and also call createGrid/4 or SetTable() (not implemented in wx) or AssignTable() (not implemented in wx) to initialize its contents. like, literally do not skip that part, bestie. ๐Ÿ˜ญ

new(Parent, Id) -> wxGrid()

Types:

Parent = wxWindow:wxWindow()
Id = integer()

new(Parent, Id, Options :: [Option]) -> wxGrid()

Types:

Parent = wxWindow:wxWindow()
Id = integer()
Option =
    {pos, {X :: integer(), Y :: integer()}} |
    {size, {W :: integer(), H :: integer()}} |
    {style, integer()}

Constructor creating the grid window. ๐Ÿฆ‹

You must call either createGrid/4 or SetTable() (not implemented in wx) or AssignTable() (not implemented in wx) to initialize the grid contents before using it. no cap, the grid needs its contents before it can serve. ๐Ÿ’…

destroy(This :: wxGrid()) -> ok

Destructor. ๐Ÿ’€

This will also destroy the associated grid table unless you passed a table object to the grid and specified that the grid should not take ownership of the table (see SetTable() (not implemented in wx)). so yeah, ownership vibes matter here. ๐Ÿซถ

appendCols(This) -> boolean()

Types:

This = wxGrid()

appendCols(This, Options :: [Option]) -> boolean()

Types:

This = wxGrid()
Option = {numCols, integer()} | {updateLabels, boolean()}

Appends one or more new columns to the right of the grid. ๐ŸŒˆ

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wxGridTableBase::AppendCols() (not implemented in wx). See insertCols/2 for further information.

Return: true on success or false if appending columns failed. bestie, check that return value. ๐ŸŽ€

appendRows(This) -> boolean()

Types:

This = wxGrid()

appendRows(This, Options :: [Option]) -> boolean()

Types:

This = wxGrid()
Option = {numRows, integer()} | {updateLabels, boolean()}

Appends one or more new rows to the bottom of the grid. ๐ŸŒธ

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wxGridTableBase::AppendRows() (not implemented in wx). See insertRows/2 for further information.

Return: true on success or false if appending rows failed. fr fr, check it. ๐Ÿ’–

autoSize(This) -> ok

Types:

This = wxGrid()

Automatically sets the height and width of all rows and columns to fit their contents. it's giving "make it fit" energy. โœจ

autoSizeColumn(This, Col) -> ok

Types:

This = wxGrid()
Col = integer()

autoSizeColumn(This, Col, Options :: [Option]) -> ok

Types:

This = wxGrid()
Col = integer()
Option = {setAsMin, boolean()}

Automatically sizes the column to fit its contents. ๐Ÿฆ‹

If setAsMin is true the calculated width will also be set as the minimal width for the column. lowkey useful. ๐Ÿ’…

autoSizeColumns(This) -> ok

Types:

This = wxGrid()

autoSizeColumns(This, Options :: [Option]) -> ok

Types:

This = wxGrid()
Option = {setAsMin, boolean()}

Automatically sizes all columns to fit their contents. ๐ŸŒˆ

If setAsMin is true the calculated widths will also be set as the minimal widths for the columns. periodt. ๐ŸŽ€

autoSizeRow(This, Row) -> ok

Types:

This = wxGrid()
Row = integer()

autoSizeRow(This, Row, Options :: [Option]) -> ok

Types:

This = wxGrid()
Row = integer()
Option = {setAsMin, boolean()}

Automatically sizes the row to fit its contents. ๐ŸŒธ

If setAsMin is true the calculated height will also be set as the minimal height for the row. bestie, it's the row version of the column glow-up. ๐Ÿ’–

autoSizeRows(This) -> ok

Types:

This = wxGrid()

autoSizeRows(This, Options :: [Option]) -> ok

Types:

This = wxGrid()
Option = {setAsMin, boolean()}

Automatically sizes all rows to fit their contents. โœจ

If setAsMin is true the calculated heights will also be set as the minimal heights for the rows. yep yep. ๐Ÿซถ

beginBatch(This) -> ok

Types:

This = wxGrid()

Increments the grid's batch count. ๐Ÿ”ฅ

When the count is greater than zero repainting of the grid is suppressed. Each call to BeginBatch must be matched by a later call to endBatch/1. Code that does a lot of grid modification can be enclosed between beginBatch/1 and endBatch/1 calls to avoid screen flicker. The final endBatch/1 call will cause the grid to be repainted. so it's giving "hold the repaint, bestie" energy. ๐Ÿ’…

Notice that you should use wxGridUpdateLocker (not implemented in wx) which ensures that there is always a matching endBatch/1 call for this beginBatch/1 if possible instead of calling this method directly. like, the safer route is right there. ๐ŸŽ€

blockToDeviceRect(This, TopLeft, BottomRight) -> {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}

Types:

This = wxGrid()
TopLeft = BottomRight = {R :: integer(), C :: integer()}

Convert grid cell coordinates to grid window pixel coordinates. ๐ŸŒˆ

This function returns the rectangle that encloses the block of cells limited by topLeft and bottomRight cell in device coords and clipped to the client size of the grid window. it's literally mapping your cell block into pixel-land. โœจ

Since: 3.1.3 Parameter gridWindow has been added.

See: cellToRect/3 ๐Ÿ’–

canDragCell(This) -> boolean()

Types:

This = wxGrid()

Return true if the dragging of cells is enabled or false otherwise. simple vibe check. ๐Ÿฆ‹

canDragColMove(This) -> boolean()

Types:

This = wxGrid()

Returns true if columns can be moved by dragging with the mouse. ๐ŸŒธ

Columns can be moved by dragging on their labels. no cap, labels are the handle. ๐Ÿ’…

canDragGridRowEdges(This) -> boolean()

Types:

This = wxGrid()

Return true if row edges inside the grid can be dragged to resize the rows. ๐Ÿซถ

See: canDragGridSize/1, canDragRowSize/2

Since: 3.1.4 โœจ

canDragColSize(This, Col) -> boolean()

Types:

This = wxGrid()
Col = integer()

Returns true if the given column can be resized by dragging with the mouse. ๐ŸŽ€

This function returns true if resizing the columns interactively is globally enabled, i.e. if disableDragColSize/1 hadn't been called, and if this column wasn't explicitly marked as non-resizable with DisableColResize() (not implemented in wx). so yeah, global setting plus per-column setting both have to agree. ๐Ÿ’–

canDragRowSize(This, Row) -> boolean()

Types:

This = wxGrid()
Row = integer()

Returns true if the given row can be resized by dragging with the mouse. ๐ŸŒˆ

This is the same as canDragColSize/2 but for rows. bestie, row edition. ๐Ÿฆ‹

canDragGridSize(This) -> boolean()

Types:

This = wxGrid()

Return true if the dragging of grid lines to resize rows and columns is enabled or false otherwise. it's giving grid-line drag permission slip. ๐Ÿ’…

canEnableCellControl(This) -> boolean()

Types:

This = wxGrid()

Returns true if the in-place edit control for the current grid cell can be used and false otherwise. โœจ

This function always returns false for the read-only cells. read-only means read-only, bestie. ๐Ÿ˜ญ

cellToRect(This, Coords) -> {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}

Types:

This = wxGrid()
Coords = {R :: integer(), C :: integer()}

Return the rectangle corresponding to the grid cell's size and position in logical coordinates. ๐ŸŒธ

See: blockToDeviceRect/3 ๐ŸŽ€

cellToRect(This, Row, Col) -> {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}

Types:

This = wxGrid()
Row = Col = integer()

Return the rectangle corresponding to the grid cell's size and position in logical coordinates. ๐Ÿฆ‹

See: blockToDeviceRect/3 ๐Ÿ’–

clearGrid(This) -> ok

Types:

This = wxGrid()

Clears all the data in the underlying grid table and repaints the grid. ๐Ÿงผโœจ

The table is not deleted by this function, bestie โ€” it just gets emptied. And real talk: if you're using a derived table class then you need to override wxGridTableBase::Clear() (not implemented in wx) for this function to have any effect. Otherwise it's just gonna stand there looking pretty and doing absolutely nothing ๐Ÿ˜ญ


clearSelection(This) -> ok

Types:

This = wxGrid()

Deselects every cell that's currently selected. Poof ๐Ÿ’จ โ€” no more highlights, the whole grid is just chilling now.


createGrid(This, NumRows, NumCols) -> boolean()

Types:

This = wxGrid()
NumRows = NumCols = integer()

createGrid(This, NumRows, NumCols, Options :: [Option]) -> boolean()

Types:

This = wxGrid()
NumRows = NumCols = integer()
Option = {selmode, wx:wx_enum()}

Creates a grid with the initial number of rows and columns you specify. ๐ŸŽ€

Call this directly after the grid constructor โ€” like, immediately, no detours. When you use this function wxGrid will create and manage a simple table of string values for you, and all of the grid data will be stored in memory. Very "keep it simple, keep it in RAM" of it ๐Ÿ’…

For applications with more complex data types or relationships, or for dealing with very large datasets, you should derive your own grid table class and pass a table object to the grid with SetTable() (not implemented in wx) or AssignTable() (not implemented in wx). That's the grown-up route โœจ


deleteCols(This) -> boolean()

Types:

This = wxGrid()

deleteCols(This, Options :: [Option]) -> boolean()

Types:

This = wxGrid()
Option =
    {pos, integer()} |
    {numCols, integer()} |
    {updateLabels, boolean()}

Deletes one or more columns from a grid, starting at the specified position. Bye columns ๐Ÿ‘‹๐Ÿ’

Heads up: the updateLabels argument is not used at present. If you're using a derived grid table class you'll need to override wxGridTableBase::DeleteCols() (not implemented in wx). See insertCols/2 for further information.

Return: true on success, or false if deleting columns failed. ๐Ÿ˜ค


deleteRows(This) -> boolean()

Types:

This = wxGrid()

deleteRows(This, Options :: [Option]) -> boolean()

Types:

This = wxGrid()
Option =
    {pos, integer()} |
    {numRows, integer()} |
    {updateLabels, boolean()}

Deletes one or more rows from a grid, starting at the specified position. Rows, but make it gone ๐Ÿซก

Same warning as above: updateLabels is not used at present. If you're using a derived grid table class you'll need to override wxGridTableBase::DeleteRows() (not implemented in wx). See insertRows/2 for further information.

Return: true on success, or false if deleting rows failed. ๐Ÿ˜ค


disableCellEditControl(This) -> ok

Types:

This = wxGrid()

Disables in-place editing of grid cells. Equivalent to calling EnableCellEditControl(false). โœจ


disableDragColSize(This) -> ok

Types:

This = wxGrid()

Disables column sizing by dragging with the mouse. Equivalent to passing false to enableDragColSize/2. ๐Ÿ–ฑ๏ธ๐Ÿšซ


disableDragGridSize(This) -> ok

Types:

This = wxGrid()

Disables mouse dragging of grid lines to resize rows and columns. Equivalent to passing false to enableDragGridSize/2. ๐Ÿ–ฑ๏ธ๐Ÿšซ


disableDragRowSize(This) -> ok

Types:

This = wxGrid()

Disables row sizing by dragging with the mouse. Equivalent to passing false to enableDragRowSize/2. ๐Ÿ–ฑ๏ธ๐Ÿšซ


enableCellEditControl(This) -> ok

Types:

This = wxGrid()

enableCellEditControl(This, Options :: [Option]) -> ok

Types:

This = wxGrid()
Option = {enable, boolean()}

Enables or disables in-place editing of grid cell data. โœ๏ธ

  • Enabling in-place editing generates wxEVT_GRID_EDITOR_SHOWN and, if it isn't vetoed by the application, shows the in-place editor which lets the user change the cell value.
  • Disabling in-place editing does nothing if the in-place editor isn't currently shown. Otherwise the wxEVT_GRID_EDITOR_HIDDEN event is generated โ€” but unlike the "shown" event, it can't be vetoed, and the in-place editor is dismissed unconditionally. No take-backs, periodt ๐Ÿ’€
โš ๏ธ Note that it is an error to call this function if the current cell is read-only. Use canEnableCellControl/1 to check for this precondition first, bestie โ€” don't just yolo it.

enableDragColSize(This) -> ok

Types:

This = wxGrid()

enableDragColSize(This, Options :: [Option]) -> ok

Types:

This = wxGrid()
Option = {enable, boolean()}

Enables or disables column sizing by dragging with the mouse. ๐Ÿ–ฑ๏ธโœจ

See: DisableColResize() (not implemented in wx)


enableDragGridSize(This) -> ok

Types:

This = wxGrid()

enableDragGridSize(This, Options :: [Option]) -> ok

Types:

This = wxGrid()
Option = {enable, boolean()}

Enables or disables row and column resizing by dragging gridlines with the mouse. Two for one, we love to see it ๐Ÿซถ


enableDragRowSize(This) -> ok

Types:

This = wxGrid()

enableDragRowSize(This, Options :: [Option]) -> ok

Types:

This = wxGrid()
Option = {enable, boolean()}

Enables or disables row sizing by dragging with the mouse. ๐Ÿ–ฑ๏ธโœจ

See: DisableRowResize() (not implemented in wx)


enableEditing(This, Edit) -> ok

Types:

This = wxGrid()
Edit = boolean()

Makes the grid globally editable or read-only. ๐Ÿ‘‘

  • If the Edit argument is false, this function sets the whole grid as read-only.
  • If the argument is true, the grid is set to the default state where cells may be editable.

In the default state you can set single grid cells and whole rows and columns to be editable or read-only via wxGridCellAttr:setReadOnly/2. For single cells you can also use the shortcut function setReadOnly/4. ๐Ÿ’…

For more information about controlling grid cell attributes see the wxGridCellAttr class and the overview_grid.


enableGridLines(This) -> ok

Types:

This = wxGrid()

enableGridLines(This, Options :: [Option]) -> ok

Types:

This = wxGrid()
Option = {enable, boolean()}

Turns the drawing of grid lines on or off. Lines: on. Lines: off. The power is yours ๐ŸŽ€


endBatch(This) -> ok

Types:

This = wxGrid()

Decrements the grid's batch count. ๐Ÿ”ข

When the count is greater than zero, repainting of the grid is suppressed. Every previous call to beginBatch/1 must be matched by a later call to endBatch/1 โ€” matched, bestie, like a matching set, no leftovers ๐ŸŽ€. Code that does a lot of grid modification can be enclosed between beginBatch/1 and endBatch/1 calls to avoid screen flicker. The final endBatch/1 will cause the grid to be repainted. โœจ

See: wxGridUpdateLocker (not implemented in wx)


fit(This) -> ok

Types:

This = wxGrid()

Overridden wxWindow method. That's it, that's the whole vibe ๐Ÿ™ˆ


forceRefresh(This) -> ok

Types:

This = wxGrid()

Causes immediate repainting of the grid. โšก Use this instead of the usual wxWindow:refresh/2.


getBatchCount(This) -> integer()

Types:

This = wxGrid()

Returns the number of times that beginBatch/1 has been called without (yet) matching calls to endBatch/1. ๐Ÿงฎ

While the grid's batch count is greater than zero, the display will not be updated. Nothing to see here, literally ๐Ÿ˜Œ


getCellAlignment(This, Row, Col) -> {Horiz :: integer(), Vert :: integer()}

Types:

This = wxGrid()
Row = Col = integer()

Sets the arguments to the horizontal and vertical text alignment values for the grid cell at the specified location. (Yes, "sets the arguments" โ€” that's what it says, we don't make the rules ๐Ÿ’…)

  • Horizontal alignment will be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT.
  • Vertical alignment will be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM.

getCellBackgroundColour(This, Row, Col) -> wx:wx_colour4()

Types:

This = wxGrid()
Row = Col = integer()

Returns the background colour of the cell at the specified location. ๐ŸŽจ


getCellEditor(This, Row, Col) -> wxGridCellEditor:wxGridCellEditor()

Types:

This = wxGrid()
Row = Col = integer()

Returns a pointer to the editor for the cell at the specified location. โœ๏ธ

See wxGridCellEditor and the overview_grid for more information about cell editors and renderers.

๐Ÿซถ Important: the caller must call DecRef() on the returned pointer. Don't forget, or the ref count will be living its own life ๐Ÿ˜ญ

getCellFont(This, Row, Col) -> wxFont:wxFont()

Types:

This = wxGrid()
Row = Col = integer()

Returns the font for text in the grid cell at the specified location. ๐Ÿ–‹๏ธโœจ


getCellRenderer(This, Row, Col) -> wxGridCellRenderer:wxGridCellRenderer()

Types:

This = wxGrid()
Row = Col = integer()

Returns a pointer to the renderer for the grid cell at the specified location. ๐ŸŽจ

See wxGridCellRenderer and the overview_grid for more information about cell editors and renderers.

๐Ÿซถ Again, because it matters: the caller must call DecRef() on the returned pointer.

getCellTextColour(This, Row, Col) -> wx:wx_colour4()

Types:

This = wxGrid()
Row = Col = integer()

Returns the text colour for the grid cell at the specified location. ๐Ÿ–๏ธ


getCellValue(This, Coords) -> unicode:charlist()

Types:

This = wxGrid()
Coords = {R :: integer(), C :: integer()}

Returns the string contained in the cell at the specified location. ๐Ÿ“

For simple applications where a grid object automatically uses a default grid table of string values, you use this function together with setCellValue/4 to access cell values. For more complex applications where you've derived your own grid table class that contains various data types (e.g. numeric, boolean or user-defined custom types) then you only use this function for those cells that contain string values. iykyk ๐Ÿฆ‹

...and yeah, same energy as before: peep wxGridTableBase::CanGetValueAs() (not implemented in wx) plus overview_grid if you want the full lore ๐Ÿ’…

getCellValue(This, Row, Col) -> unicode:charlist()

Types:

This = wxGrid()
Row = Col = integer()

Gives you back the string sitting in the cell at that exact spot โœจ

So like, super simple apps where your grid object just auto-uses a default grid table full of string values? You pair this one with setCellValue/4 and you're literally done accessing cell values ๐ŸŽ€

But for the fancier setups โ€” where you've derived your own grid table class holding all sorts of types (numeric, boolean, or your own custom lil user-defined types) โ€” then you only reach for this function on the cells that actually hold string values, mmkay?

See wxGridTableBase::CanGetValueAs() (not implemented in wx) and the overview_grid for more info ๐Ÿฆ‹


getColLabelAlignment(This) -> {Horiz :: integer(), Vert :: integer()}

Types:

This = wxGrid()

Drops the current column label alignment values into the arguments, slay ๐Ÿ’…

Horizontally it'll be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT.

Vertically it'll be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM.


getColLabelSize(This) -> integer()

Types:

This = wxGrid()

Returns the current height of the column labels ๐Ÿ“ iconic frankly


getColLabelValue(This, Col) -> unicode:charlist()

Types:

This = wxGrid()
Col = integer()

Hands you the specified column label ๐Ÿ’–

The default grid table class serves up labels in the form A,B...Z,AA,AB...ZZ,AAA... โ€” cute right? And if you're running a custom grid table, you can override wxGridTableBase::GetColLabelValue() (not implemented in wx) and make your own labels, no cap ๐ŸŽ€


getColMinimalAcceptableWidth(This) -> integer()

Types:

This = wxGrid()

Returns the minimal width a column is allowed to be resized down to ๐Ÿ™ˆ

Wanna change it? Use setColMinimalAcceptableWidth/2 to do it globally, or setColMinimalWidth/3 if you only care about individual columns โœจ

See: getRowMinimalAcceptableHeight/1


getDefaultCellAlignment(This) -> {Horiz :: integer(), Vert :: integer()}

Types:

This = wxGrid()

Returns the default cell alignment, bestie ๐Ÿซถ

Horizontal alignment will be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT.

Vertical alignment will be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM.

See: setDefaultCellAlignment/3


getDefaultCellBackgroundColour(This) -> wx:wx_colour4()

Types:

This = wxGrid()

Returns the current default background colour for grid cells ๐ŸŒˆ serving looks


getDefaultCellFont(This) -> wxFont:wxFont()

Types:

This = wxGrid()

Returns the current default font used for grid cell text โ€” typography era ๐ŸŽ€


getDefaultCellTextColour(This) -> wx:wx_colour4()

Types:

This = wxGrid()

Returns the current default colour for grid cell text โœจ


getDefaultColLabelSize(This) -> integer()

Types:

This = wxGrid()

Returns the default height for column labels, periodt ๐Ÿ“


getDefaultColSize(This) -> integer()

Types:

This = wxGrid()

Returns the current default width for grid columns ๐Ÿ’…


getDefaultEditor(This) -> wxGridCellEditor:wxGridCellEditor()

Types:

This = wxGrid()

Gives you a pointer to the current default grid cell editor ๐Ÿ‘‘

See wxGridCellEditor and the overview_grid for the whole tea on cell editors and renderers.


getDefaultEditorForCell(This, C) -> wxGridCellEditor:wxGridCellEditor()

Types:

This = wxGrid()
C = {R :: integer(), C :: integer()}

Returns the default editor for the specified cell โœจ

The base class version returns whatever editor suits the current cell type โ€” but derived classes can override this to use custom editors for certain cells by default ๐ŸŽ€

Oh and heads up: you can usually achieve the same thing in a simpler way by just associating a custom editor with the given cell or cells.

โš ๏ธ The caller must call DecRef() on the returned pointer. Not optional, bestie ๐Ÿ˜ญ

getDefaultEditorForCell(This, Row, Col) -> wxGridCellEditor:wxGridCellEditor()

Types:

This = wxGrid()
Row = Col = integer()

Same deal, returns the default editor for the specified cell ๐Ÿ’–

The base class version returns the editor appropriate for the current cell type, but this method may be overridden in derived classes to use custom editors for some cells by default.

Notice that the same may be achieved in a usually simpler way by associating a custom editor with the given cell or cells.

โš ๏ธ The caller must call DecRef() on the returned pointer, fr fr ๐Ÿซถ

getDefaultEditorForType(This, TypeName) -> wxGridCellEditor:wxGridCellEditor()

Types:

This = wxGrid()
TypeName = unicode:chardata()

Returns the default editor for cells holding values of the given type ๐Ÿ‘‘

The base class version returns the editor that got associated with the specified typeName back when it was registered via registerDataType/4 โ€” but this function can be overridden to return something different. That's how you override an editor used for one of the standard types, iykyk โœจ

โš ๏ธ The caller must call DecRef() on the returned pointer ๐Ÿ’…

getDefaultRenderer(This) -> wxGridCellRenderer:wxGridCellRenderer()

Types:

This = wxGrid()

Returns a pointer to the current default grid cell renderer ๐ŸŽจโœจ

See wxGridCellRenderer and the overview_grid for more about cell editors and renderers.

โš ๏ธ The caller must call DecRef() on the returned pointer ๐Ÿ˜ญ

getDefaultRendererForCell(This, Row, Col) -> wxGridCellRenderer:wxGridCellRenderer()

Types:

This = wxGrid()
Row = Col = integer()

Returns the default renderer for the given cell ๐ŸŒธ

The base class version returns the renderer appropriate for the current cell type, but this method may be overridden in derived classes to use custom renderers for some cells by default.

โš ๏ธ The caller must call DecRef() on the returned pointer, no exceptions ๐Ÿซถ

getDefaultRendererForType(This, TypeName) -> wxGridCellRenderer:wxGridCellRenderer()

Types:

This = wxGrid()
TypeName = unicode:chardata()

Returns the default renderer for cells containing values of the given type ๐Ÿ’–

See: getDefaultEditorForType/2


getDefaultRowLabelSize(This) -> integer()

Types:

This = wxGrid()

Returns the default width for the row labels ๐Ÿ“


getDefaultRowSize(This) -> integer()

Types:

This = wxGrid()

Returns the current default height for grid rows ๐Ÿ’…


getGridCursorCol(This) -> integer()

Types:

This = wxGrid()

Returns the current grid cell column position ๐ŸŽฏ

See: GetGridCursorCoords() (not implemented in wx)


getGridCursorRow(This) -> integer()

Types:

This = wxGrid()

Returns the current grid cell row position ๐ŸŽฏ

See: GetGridCursorCoords() (not implemented in wx)


getGridLineColour(This) -> wx:wx_colour4()

Types:

This = wxGrid()

Returns the colour used for grid lines ๐ŸŒˆ

See: GetDefaultGridLinePen() (not implemented in wx)


gridLinesEnabled(This) -> boolean()

Types:

This = wxGrid()

Returns true if drawing of grid lines is turned on, false otherwise โœ…โŒ


getLabelBackgroundColour(This) -> wx:wx_colour4()

Types:

This = wxGrid()

Returns the colour used for the background of row and column labels ๐ŸŽ€


getLabelFont(This) -> wxFont:wxFont()

Types:

This = wxGrid()

Returns the font used for row and column labels โœจ


getLabelTextColour(This) -> wx:wx_colour4()

Types:

This = wxGrid()

Returns the colour used for row and column label text ๐Ÿ’–


getNumberCols(This) -> integer()

Types:

This = wxGrid()

Returns the total number of grid columns ๐Ÿ”ข

Which is literally the same as the number of columns in the underlying grid table, bestie.


getNumberRows(This) -> integer()

Types:

This = wxGrid()

Returns the total number of grid rows ๐Ÿ”ข

Same as the number of rows in the underlying grid table. Periodt.


getOrCreateCellAttr(This, Row, Col) -> wxGridCellAttr:wxGridCellAttr()

Types:

This = wxGrid()
Row = Col = integer()

Returns the attribute for the given cell, creating one if it needs to ๐Ÿ‘‘

If the cell already has an attribute, you get that one back. Otherwise a brand new attribute is created, associated with the cell, and returned. Either way the caller must call DecRef() on the returned pointer ๐Ÿ˜ญ

Prefer using GetOrCreateCellAttrPtr() (not implemented in wx) so you don't have to deal with calling DecRef() on the returned pointer at all โ€” way less stress, fr fr.

โš ๏ธ This function may only be called if CanHaveAttributes() (not implemented in wx) returns true.

getRowMinimalAcceptableHeight(This) -> integer()

Types:

This = wxGrid()

Returns the minimal size rows can be resized down to ๐Ÿ™ˆ

Use setRowMinimalAcceptableHeight/2 to change this globally, or setRowMinimalHeight/3 to change it for individual cells โœจ

See: getColMinimalAcceptableWidth/1


getRowLabelAlignment(This) -> {Horiz :: integer(), Vert :: integer()}

Types:

This = wxGrid()

Returns the alignment used for row labels ๐Ÿ’…

Horizontal alignment will be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT.

Vertical alignment will be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM.


getRowLabelSize(This) -> integer()

Types:

This = wxGrid()

Returns the current width of the row labels ๐Ÿ“ and that's the vibe ๐Ÿฆ‹

๐Ÿท๏ธ getRowLabelValue(This, Row) -> unicode:charlist()

Types:

This = wxGrid()
Row = integer()

Returns the label for that row, bestie. The default grid table class gives you numeric row labels. If youโ€™re using a custom grid table, you can override wxGridTableBase::GetRowLabelValue() (not implemented in wx) to make your own labels. ๐Ÿ’…

๐Ÿ“ getRowSize(This, Row) -> integer()

Types:

This = wxGrid()
Row = integer()

Returns the height of the specified row. Thatโ€™s it, thatโ€™s the vibe. โœจ

โ†”๏ธ getScrollLineX(This) -> integer()

Types:

This = wxGrid()

Returns how many pixels there are per horizontal scroll increment. The default is 15.

See: getScrollLineY/1, setScrollLineX/2, setScrollLineY/2

โ†•๏ธ getScrollLineY(This) -> integer()

Types:

This = wxGrid()

Returns how many pixels there are per vertical scroll increment. The default is 15.

See: getScrollLineX/1, setScrollLineX/2, setScrollLineY/2


๐ŸŽฏ getSelectedCells(This) -> [{R :: integer(), C :: integer()}]

Types:

This = wxGrid()

Returns an array of individually selected cells. But listen, bestie: this array does not contain all the selected cells in general, because it doesnโ€™t include cells selected as part of column, row or block selection. You have to use this method, getSelectedCols/1, getSelectedRows/1, and getSelectionBlockTopLeft/1 plus getSelectionBlockBottomRight/1 to get the entire selection in general. ๐Ÿ˜ญ

Please notice this behaviour is by design and is needed to support grids of arbitrary size. Like, when an entire column is selected in a grid with a million of columns, we donโ€™t want to create an array with a million of entries in this function โ€” instead it returns an empty array and getSelectedCols/1 returns an array containing one element. Iconic efficiency, honestly.

The function can be slow for the big grids, so use GetSelectedBlocks() (not implemented in wx) in the new code. ๐Ÿซถ

๐Ÿ“Š getSelectedCols(This) -> [integer()]

Types:

This = wxGrid()

Returns an array of selected columns. Please notice that this method alone is not sufficient to find all the selected columns, because it contains only the columns which were individually selected โ€” not those being part of the block selection or being selected in virtue of all of their cells being selected individually. Please see getSelectedCells/1 for more details. ๐Ÿ’–

The function can be slow for the big grids, use GetSelectedBlocks() (not implemented in wx) in the new code.

๐Ÿ“ˆ getSelectedRows(This) -> [integer()]

Types:

This = wxGrid()

Returns an array of selected rows. Same warning as above, bestie: this method alone is not sufficient to find all the selected rows, because it contains only the rows which were individually selected โ€” not those being part of the block selection or being selected in virtue of all of their cells being selected individually. Please see getSelectedCells/1 for more details. ๐ŸŒธ

The function can be slow for the big grids, use GetSelectedBlocks() (not implemented in wx) in the new code.

๐ŸŽจ getSelectionBackground(This) -> wx:wx_colour4()

Types:

This = wxGrid()

Returns the colour used for drawing the selection background. Glow-up for selected stuff โœจ

๐Ÿงฉ getSelectionBlockTopLeft(This) -> [{R :: integer(), C :: integer()}]

Types:

This = wxGrid()

Returns an array of the top left corners of blocks of selected cells. Please see getSelectedCells/1 for more information about the selection representation in wxGrid. ๐Ÿงš

The function can be slow for the big grids, use GetSelectedBlocks() (not implemented in wx) in the new code.

See: getSelectionBlockBottomRight/1

๐Ÿงฉ getSelectionBlockBottomRight(This) -> [{R :: integer(), C :: integer()}]

Types:

This = wxGrid()

Returns an array of the bottom right corners of blocks of selected cells. Please see getSelectedCells/1 for more information about the selection representation in wxGrid. ๐Ÿ’œ

The function can be slow for the big grids, use GetSelectedBlocks() (not implemented in wx) in the new code.

See: getSelectionBlockTopLeft/1

๐Ÿ–๏ธ getSelectionForeground(This) -> wx:wx_colour4()

Types:

This = wxGrid()

Returns the colour used for drawing the selection foreground. So the text stays cute and readable, obviously. ๐Ÿ’…


๐ŸชŸ getGridWindow(This) -> wxWindow:wxWindow()

Types:

This = wxGrid()

Return the main grid window containing the grid cells. This window is always shown. Main character energy, no cap. ๐Ÿ‘‘

๐Ÿท๏ธ getGridRowLabelWindow(This) -> wxWindow:wxWindow()

Types:

This = wxGrid()

Return the row labels window. This window is not shown if the row labels were hidden using HideRowLabels() (not implemented in wx). ๐Ÿ™ˆ

๐Ÿท๏ธ getGridColLabelWindow(This) -> wxWindow:wxWindow()

Types:

This = wxGrid()

Return the column labels window. This window is not shown if the columns labels were hidden using HideColLabels() (not implemented in wx). ๐Ÿ‘€

Depending on whether UseNativeColHeader() (not implemented in wx) was called or not, this can be either a wxHeaderCtrl (not implemented in wx) or a plain wxWindow. This function returns a valid window pointer in either case, but in the former case you can also use GetGridColHeader() (not implemented in wx) to access it if you need wxHeaderCtrl-specific functionality. ๐Ÿฆ‹

๐Ÿงญ getGridCornerLabelWindow(This) -> wxWindow:wxWindow()

Types:

This = wxGrid()

Return the window in the top left grid corner. This window is shown only when both columns and row labels are shown and normally doesnโ€™t contain anything. Clicking on it is handled by wxGrid however and can be used to select the entire grid. Lowkey iconic. โญ

๐Ÿ™ˆ hideCellEditControl(This) -> ok

Types:

This = wxGrid()

Hides the in-place cell edit control. Poof, gone. ๐ŸŽ€


โž• insertCols(This) -> boolean()

Types:

This = wxGrid()

โž• insertCols(This, Options :: [Option]) -> boolean()

Types:

This = wxGrid()
Option =
    {pos, integer()} |
    {numCols, integer()} |
    {updateLabels, boolean()}

Inserts one or more new columns into a grid with the first new column at the specified position. ๐Ÿ’–

Notice that inserting the columns in the grid requires grid table cooperation: when this method is called, the grid object begins by requesting the underlying grid table to insert new columns. If this is successful the table notifies the grid and the grid updates the display. For a default grid (one where you have called createGrid/4) this process is automatic. If you are using a custom grid table (specified with SetTable() (not implemented in wx) or AssignTable() (not implemented in wx)) then you must override wxGridTableBase::InsertCols() (not implemented in wx) in your derived table class. ๐Ÿงš

Return: true if the columns were successfully inserted, false if an error occurred (most likely the table couldnโ€™t be updated).

โž• insertRows(This) -> boolean()

Types:

This = wxGrid()

โž• insertRows(This, Options :: [Option]) -> boolean()

Types:

This = wxGrid()
Option =
    {pos, integer()} |
    {numRows, integer()} |
    {updateLabels, boolean()}

Inserts one or more new rows into a grid with the first new row at the specified position. ๐Ÿซถ

Notice that you must implement wxGridTableBase::InsertRows() (not implemented in wx) if you use a grid with a custom table, please see insertCols/2 for more information.

Return: true if the rows were successfully inserted, false if an error occurred (most likely the table couldnโ€™t be updated). ๐Ÿ’€


โœ… isCellEditControlEnabled(This) -> boolean()

Types:

This = wxGrid()

Returns true if the in-place edit control is currently enabled. Slay. โœจ

๐Ÿ”’ isCurrentCellReadOnly(This) -> boolean()

Types:

This = wxGrid()

Returns true if the current cell is read-only. No editing that one, bestie.

See: setReadOnly/4, isReadOnly/3

โœ๏ธ isEditable(This) -> boolean()

Types:

This = wxGrid()

Returns false if the whole grid has been set as read-only or true otherwise.

See enableEditing/2 for more information about controlling the editing status of grid cells. ๐ŸŽ€

๐ŸŽฏ isInSelection(This, Coords) -> boolean()

Types:

This = wxGrid()
Coords = {R :: integer(), C :: integer()}

Returns true if the given cell is selected. ๐Ÿ’…

๐ŸŽฏ isInSelection(This, Row, Col) -> boolean()

Types:

This = wxGrid()
Row = Col = integer()

Returns true if the given cell is selected. Same vibe, different argument shape. ๐Ÿฆ‹

๐Ÿ”’ isReadOnly(This, Row, Col) -> boolean()

Types:

This = wxGrid()
Row = Col = integer()

Returns true if the cell at the specified location canโ€™t be edited.

See: setReadOnly/4, isCurrentCellReadOnly/1

๐Ÿซถ isSelection(This) -> boolean()

Types:

This = wxGrid()

Returns true if there are currently any selected cells, rows, columns or blocks. Vibe check: is anything selected? Yes maโ€™am. โœจ

๐Ÿ‘€ isVisible(This, Coords) -> boolean()

Types:

This = wxGrid()
Coords = {R :: integer(), C :: integer()}

๐Ÿ‘€ isVisible(This, Row, Col) -> boolean()

๐Ÿ‘€ isVisible(This, Coords, Col :: [Option]) -> boolean()

Types:

This = wxGrid()
Coords = {R :: integer(), C :: integer()}
Option = {wholeCellVisible, boolean()}

Returns true if a cell is either entirely or at least partially visible in the grid window. ๐Ÿ‘‘

By default, the cell must be entirely visible for this function to return true, but if wholeCellVisible is false, the function returns true even if the cell is only partially visible. ๐ŸŒˆ

๐Ÿ‘€ isVisible(This, Row, Col, Options :: [Option]) -> boolean()

Types:

โ€ฆand the types for isVisible wrap up like this, bestie:

This = wxGrid()
Row = Col = integer()
Option = {wholeCellVisible, boolean()}

Returns true if a cell is either entirely or at least partially visible in the grid window. ๐Ÿ‘€

By default the cell has to be completely visible for this to return true โ€” but if you pass wholeCellVisible as false, then it'll return true even when just a lil sliver of the cell is peeking through. โœจ


makeCellVisible(This, Coords) -> ok

Types:

This = wxGrid()
Coords = {R :: integer(), C :: integer()}

Brings the specified cell into the visible grid cell area with minimal scrolling โ€” like, it does the bare minimum amount of scroll to get that cell on screen, no dramatic zoomies. ๐ŸŽ€

Does absolutely nothing if the cell is already visible. Zero notes. ๐Ÿ’…

makeCellVisible(This, Row, Col) -> ok

Types:

This = wxGrid()
Row = Col = integer()

Same deal as above, just with Row and Col handed to you separately instead of bundled in a tuple. Brings that cell into the visible area with minimal scrolling, and does nothing if it's already visible. ๐Ÿซถ

moveCursorDown(This, ExpandSelection) -> boolean()

Types:

This = wxGrid()
ExpandSelection = boolean()

Moves the grid cursor down by one row. โฌ‡๏ธ

If a block of cells was previously selected, it will expand when the argument is true, or get cleared when the argument is false. Choose your fighter. ๐ŸฅŠ

moveCursorLeft(This, ExpandSelection) -> boolean()

Types:

This = wxGrid()
ExpandSelection = boolean()

Moves the grid cursor left by one column. โฌ…๏ธ

Same selection tea: previous block selection expands if the argument is true, gets cleared if it's false. ๐Ÿ“

moveCursorRight(This, ExpandSelection) -> boolean()

Types:

This = wxGrid()
ExpandSelection = boolean()

Moves the grid cursor right by one column. โžก๏ธ

Block selection from before? Expands with true, cleared with false. That's it, that's the whole vibe. ๐Ÿ’œ

moveCursorUp(This, ExpandSelection) -> boolean()

Types:

This = wxGrid()
ExpandSelection = boolean()

Moves the grid cursor up by one row. โฌ†๏ธ

And yep โ€” previously selected block expands if true, clears if false. ๐ŸŒธ


ok now we're getting to the block versions, which are lowkey the main character versions of the cursor movers ๐Ÿ‘‘

moveCursorDownBlock(This, ExpandSelection) -> boolean()

Types:

This = wxGrid()
ExpandSelection = boolean()

Moves the grid cursor down in the current column so that it skips to the beginning or end of a block of non-empty cells. Like it hops over the whole filled-in chunk. ๐Ÿ”ฅ

If a block of cells was previously selected it will expand if the argument is true or be cleared if the argument is false.

moveCursorLeftBlock(This, ExpandSelection) -> boolean()

Types:

This = wxGrid()
ExpandSelection = boolean()

Moves the grid cursor left in the current row so that it skips to the beginning or end of a block of non-empty cells. ๐Ÿฆ‹

Previous block selection expands with true, cleared with false.

moveCursorRightBlock(This, ExpandSelection) -> boolean()

Types:

This = wxGrid()
ExpandSelection = boolean()

Moves the grid cursor right in the current row, skipping to the beginning or end of a block of non-empty cells. โœจ

Same selection behaviour, obviously: true = expand, false = clear.

moveCursorUpBlock(This, ExpandSelection) -> boolean()

Types:

This = wxGrid()
ExpandSelection = boolean()

Moves the grid cursor up in the current column, skipping to the beginning or end of a block of non-empty cells. ๐Ÿงš

And once again: previous block selection expands if true, gets cleared if false. ๐Ÿ’ซ


movePageDown(This) -> boolean()

Types:

This = wxGrid()

Moves the grid cursor down by some number of rows so that the previous bottom visible row becomes the top visible row. It's giving "page turn in a book" energy, fr fr. ๐Ÿ“–

movePageUp(This) -> boolean()

Types:

This = wxGrid()

Moves the grid cursor up by some number of rows so that the previous top visible row becomes the bottom visible row. Mirror image, same slay. ๐Ÿชž


registerDataType(This, TypeName, Renderer, Editor) -> ok

Types:

This = wxGrid()
TypeName = unicode:chardata()
Renderer = wxGridCellRenderer:wxGridCellRenderer()
Editor = wxGridCellEditor:wxGridCellEditor()

Register a new data type. ๐Ÿ‘‘

The data types let you naturally associate specific renderers and editors with cells containing values of a given type. Iconic, honestly. For example, the grid automatically registers a data type named wxGRID_VALUE_STRING which uses wxGridCellStringRenderer and wxGridCellTextEditor as its renderer and editor respectively โ€” this is the data type used by all the cells of the default wxGridStringTable (not implemented in wx), so this renderer and editor are used by default for all grid cells. ๐Ÿ’…

But if a custom table returns wxGRID_VALUE_BOOL from its wxGridTableBase::GetTypeName() (not implemented in wx) method, then wxGridCellBoolRenderer and wxGridCellBoolEditor are used for it, because the grid also registers a boolean data type with this name. ๐ŸŽ€

And since this mechanism is completely generic, you can register your own data types using your own custom renderers and editors. Just remember: the table has to identify a cell as being of the given type for them to actually get used for that cell. No type name, no renderer. Simple as. ๐Ÿซถ


saveEditControlValue(This) -> ok

Types:

This = wxGrid()

Sets the value of the current grid cell to the current in-place edit control value. ๐Ÿ’พ

This gets called automatically when the grid cursor moves from the current cell to a new cell. It's also a very good idea to call this yourself when closing a grid, since any edits to the final cell location will not be saved otherwise. Like, your last edit will just vanish into the void ๐Ÿ˜ญ so please don't forget.


selectAll(This) -> ok

Types:

This = wxGrid()

Selects all the cells in the grid. Every single one. Full send. ๐Ÿ‘‘


selectBlock(This, TopLeft, BottomRight) -> ok

Types:

This = wxGrid()
TopLeft = BottomRight = {R :: integer(), C :: integer()}

selectBlock(This, TopLeft, BottomRight, Options :: [Option]) -> ok

Types:

This = wxGrid()
TopLeft = BottomRight = {R :: integer(), C :: integer()}
Option = {addToSelected, boolean()}

Selects a rectangular block of cells. ๐Ÿ”ฒ

If addToSelected is false then any existing selection gets deselected; if true the column will be added to the existing selection.

selectBlock(This, TopRow, LeftCol, BottomRow, RightCol) -> ok

Types:

This = wxGrid()
TopRow = LeftCol = BottomRow = RightCol = integer()

selectBlock(This, TopRow, LeftCol, BottomRow, RightCol, Options :: [Option]) -> ok

Types:

This = wxGrid()
TopRow = LeftCol = BottomRow = RightCol = integer()
Option = {addToSelected, boolean()}

Selects a rectangular block of cells. Same vibe, just with the four corners handed in as separate integers instead of tuples. ๐Ÿ“

If addToSelected is false then any existing selection will be deselected; if true the column will be added to the existing selection.


selectCol(This, Col) -> ok

Types:

This = wxGrid()
Col = integer()

selectCol(This, Col, Options :: [Option]) -> ok

Types:

This = wxGrid()
Col = integer()
Option = {addToSelected, boolean()}

Selects the specified column. ๐Ÿ“Š

If addToSelected is false then any existing selection will be deselected; if true the column will be added to the existing selection.

โš ๏ธ Heads up bestie: this method won't select anything if the current selection mode is wxGridSelectRows. Not a bug, it's just how the selection mode works. ๐Ÿ’€

selectRow(This, Row) -> ok

Types:

This = wxGrid()
Row = integer()

selectRow(This, Row, Options :: [Option]) -> ok

Types:

This = wxGrid()
Row = integer()
Option = {addToSelected, boolean()}

Selects the specified row. ๐Ÿ“

If addToSelected is false then any existing selection will be deselected; if true the row will be added to the existing selection.

โš ๏ธ And same warning energy: this method won't select anything if the current selection mode is wxGridSelectColumns. ๐Ÿซ 

setCellAlignment(This, Row, Col, Horiz, Vert) -> ok

Types:

This = wxGrid()
Row = Col = Horiz = Vert = integer()

Sets the horizontal and vertical alignment for grid cell text at the specified location. ๐ŸŽฏ

Horizontal alignment should be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT.

Vertical alignment should be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM.

Yes, wxALIGN_CENTRE appears in both lists โ€” that's not a typo, that's just British spelling being its iconic self. ๐Ÿ‡ฌ๐Ÿ‡งโœจ


setCellBackgroundColour(This, Row, Col, Colour) -> ok

Types:

This = wxGrid()
Row = Col = integer()
Colour = wx:wx_colour()

Set the background colour for the given cell โ€” or for all cells by default. ๐ŸŽจ Slap some colour on it.


setCellEditor(This, Row, Col, Editor) -> ok

Types:

This = wxGrid()
Row = Col = integer()
Editor = wxGridCellEditor:wxGridCellEditor()

Sets the editor for the grid cell at the specified location. โœ๏ธ

The grid will take ownership of the pointer. So don't go freeing it yourself afterwards, bestie โ€” that's the grid's problem now. ๐Ÿ™ˆ

See wxGridCellEditor and the overview_grid for more information about cell editors and renderers.


setCellFont(This, Row, Col, Font) -> ok

Types:

This = wxGrid()
Row = Col = integer()
Font = wxFont:wxFont()

Sets the font for text in the grid cell at the specified location. ๐Ÿ”ค Make it cute, make it readable, make it whatever โ€” it's your cell.


setCellRenderer(This, Row, Col, Renderer) -> ok

Types:

This = wxGrid()
Row = Col = integer()
Renderer = wxGridCellRenderer:wxGridCellRenderer()

Sets the renderer for the grid cell at the specified location. ๐Ÿ–Œ๏ธ

The grid will take ownership of the pointer here too. Same deal โ€” hands off after you hand it over. ๐Ÿ’…

See wxGridCellRenderer and the overview_grid for more information about cell editors and renderers.


setCellTextColour(This, Row, Col, Colour) -> ok

Types:

This = wxGrid()
Row = Col = integer()

โ€ฆand this is exactly where our part cuts off, mid-Types, like a text message that got sent too early ๐Ÿ˜ญ more incoming ๐Ÿซถ

This = wxGrid()
Row = Col = integer()
Colour = wx:wx_colour()

Sets the text colour for the given cell. ๐Ÿ’…


setCellValue(This, Coords, S) -> ok

Types:

This = wxGrid()
Coords = {R :: integer(), C :: integer()}
S = unicode:chardata()

Sets the string value for the cell at the specified location. โœจ

So here's the vibe: for simple apps where a grid object just auto-uses a default grid table of string values, you pair this function with getCellValue/3 to get at your cell values. getCellValue/3, bestie, that's your other half ๐Ÿซถ

But for more complex apps โ€” the ones where you derived your own grid table class holding all sorts of data types (numeric, boolean, user-defined custom types, the whole buffet) โ€” you only use this function for the cells that actually contain string values. iykyk ๐Ÿ’โ€โ™€๏ธ

See wxGridTableBase::CanSetValueAs() (not implemented in wx) and the overview_grid for more info. ๐Ÿ‘‘

setCellValue(This, Row, Col, S) -> ok

Types:

This = wxGrid()
Row = Col = integer()
S = unicode:chardata()

Sets the string value for the cell at the specified location. Same energy, different signature โ€” this is the Row, Col flavour of the exact same thing ๐Ÿฆ‹

For simple applications where a grid object automatically uses a default grid table of string values, you use this function together with getCellValue/3 to access cell values. For more complex applications where you have derived your own grid table class containing various data types (numeric, boolean, or user-defined custom types, no cap) โ€” you only use this function for those cells that contain string values, periodt.

See wxGridTableBase::CanSetValueAs() (not implemented in wx) and the overview_grid for more information. ๐Ÿ’–

setColAttr(This, Col, Attr) -> ok

Types:

This = wxGrid()
Col = integer()
Attr = wxGridCellAttr:wxGridCellAttr()

Sets the cell attributes for all cells in the specified column. Whole column? Getting the same glow-up? Iconic โœจ

For more on controlling grid cell attributes, see the wxGridCellAttr cell attribute class and the overview_grid. ๐ŸŽ€

setColFormatBool(This, Col) -> ok

Types:

This = wxGrid()
Col = integer()

Sets the specified column to display boolean values. true/false girlies rise ๐ŸŒธ

See: setColFormatCustom/3

setColFormatNumber(This, Col) -> ok

Types:

This = wxGrid()
Col = integer()

Sets the specified column to display integer values. whole numbers only, we don't do decimals here ๐Ÿ’€

See: setColFormatCustom/3

setColFormatFloat(This, Col) -> ok

Types:

This = wxGrid()
Col = integer()

(no description in the original โ€” just the types, and honestly? mysterious queen behaviour ๐Ÿงš)

setColFormatFloat(This, Col, Options :: [Option]) -> ok

Types:

This = wxGrid()
Col = integer()
Option = {width, integer()} | {precision, integer()}

Sets the specified column to display floating point values with the given width and precision. ๐Ÿ’…

The options:

  • {width, integer()} โ€” the width, bestie integer()
  • {precision, integer()} โ€” the precision, also integer() ๐Ÿ“

See: setColFormatCustom/3

setColFormatCustom(This, Col, TypeName) -> ok

Types:

This = wxGrid()
Col = integer()
TypeName = unicode:chardata()

Sets the specified column to display data in a custom format. Main character column energy ๐Ÿ‘‘

This method is the alternative to defining a custom grid table that would return typeName from its GetTypeName() method for the cells in this column. And like โ€” it doesn't really change the type of the cells in this column, but it does associate the renderer and editor used for the cells of the specified type with them. Lowkey the same thing, highkey not ๐Ÿ˜ญ

See the overview_grid for more info on working with custom data types. ๐Ÿฆ‹

setColLabelAlignment(This, Horiz, Vert) -> ok

Types:

This = wxGrid()
Horiz = Vert = integer()

Sets the horizontal and vertical alignment of column label text. โœจ

Vibe check on the values:

  • Horizontal alignment should be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT
  • Vertical alignment should be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM ๐ŸŒˆ

setColLabelSize(This, Height) -> ok

Types:

This = wxGrid()
Height = integer()

Sets the height of the column labels. ๐Ÿ“

If height equals wxGRID_AUTOSIZE then height is calculated automatically so that no label is truncated. Obsessed with not truncating ๐Ÿ’… โ€” but note that this could be slow for a large table. ๐Ÿข

setColLabelValue(This, Col, Value) -> ok

Types:

This = wxGrid()
Col = integer()
Value = unicode:chardata()

Set the value for the given column label. ๐ŸŽ€

Heads up though: if you're using a custom grid table, you must override wxGridTableBase::SetColLabelValue() (not implemented in wx) for this to have any effect. No override, no effect, that's the rule ๐Ÿซถ

setColMinimalWidth(This, Col, Width) -> ok

Types:

This = wxGrid()
Col = Width = integer()

Sets the minimal width for the specified column col. ๐Ÿ“

Timing matters, bestie: it is usually best to call this method during grid creation, because calling it later will not resize the column to the given minimal width even if it is currently narrower than it. Rude, but true ๐Ÿ˜ญ

And width must be greater than the minimal acceptable column width as returned by getColMinimalAcceptableWidth/1. No negotiating ๐Ÿ’€

setColMinimalAcceptableWidth(This, Width) -> ok

Types:

This = wxGrid()
Width = integer()

Sets the minimal width to which the user can resize columns. Like a floor for the user's dragging dreams ๐Ÿฆ‹

See: getColMinimalAcceptableWidth/1

setColSize(This, Col, Width) -> ok

Types:

This = wxGrid()
Col = Width = integer()

Sets the width of the specified column. That's it. That's the whole function. Slay ๐Ÿ’…โœจ

setDefaultCellAlignment(This, Horiz, Vert) -> ok

Types:

This = wxGrid()
Horiz = Vert = integer()

Sets the default horizontal and vertical alignment for grid cell text. The blueprint for every cell's text placement ๐ŸŽ€

  • Horizontal alignment should be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT
  • Vertical alignment should be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM ๐ŸŒˆ

setDefaultCellBackgroundColour(This, Colour) -> ok

Types:

This = wxGrid()
Colour = wx:wx_colour()

Sets the default background colour for grid cells. The aesthetic baseline, fr fr ๐ŸŒธ

setDefaultCellFont(This, Font) -> ok

Types:

This = wxGrid()
Font = wxFont:wxFont()

Sets the default font to be used for grid cell text. Typography is a personality trait ๐Ÿ’–

setDefaultCellTextColour(This, Colour) -> ok

Types:

This = wxGrid()
Colour = wx:wx_colour()

Sets the current default colour for grid cell text. ๐Ÿ–๏ธ

setDefaultEditor(This, Editor) -> ok

Types:

This = wxGrid()
Editor = wxGridCellEditor:wxGridCellEditor()

Sets the default editor for grid cells. โœ๏ธ

โš ๏ธ The grid will take ownership of the pointer. So likeโ€ฆ don't go freeing it behind the grid's back, bestie ๐Ÿ™ˆ

See wxGridCellEditor and the overview_grid for more information about cell editors and renderers. ๐Ÿ‘‘

setDefaultRenderer(This, Renderer) -> ok

Types:

This = wxGrid()
Renderer = wxGridCellRenderer:wxGridCellRenderer()

Sets the default renderer for grid cells. ๐ŸŽจ

โš ๏ธ The grid will take ownership of the pointer. Same deal as above โ€” it's the grid's pointer now ๐Ÿ’€

See wxGridCellRenderer and the overview_grid for more information about cell editors and renderers. ๐Ÿฆ‹

setDefaultColSize(This, Width) -> ok

Types:

This = wxGrid()
Width = integer()

(types only in the original โ€” the two-arg version keeps it mysterious ๐Ÿงšโ€โ™€๏ธ)

setDefaultColSize(This, Width, Options :: [Option]) -> ok

Types:

This = wxGrid()
Width = integer()
Option = {resizeExistingCols, boolean()}

Sets the default width for columns in the grid. ๐Ÿ“

  • {resizeExistingCols, boolean()} โ€” whether the columns already in the grid also get resized

Here's the catch: this will only affect columns subsequently added to the grid unless resizeExistingCols is true. New columns only, unless you say otherwise ๐Ÿ’…

And if width is less than getColMinimalAcceptableWidth/1, then the minimal acceptable width is used instead of it. The floor wins, always ๐Ÿซถ

setDefaultRowSize(This, Height) -> ok

Types:

This = wxGrid()
Height = integer()

(again, types only โ€” the sequel always needs the three-arg version to shine โœจ)

setDefaultRowSize(This, Height, Options :: [Option]) -> ok

Types:

This = wxGrid()
Height = integer()
Option = {resizeExistingRows, boolean()}

Sets the default height for rows in the grid. ๐Ÿ“

  • {resizeExistingRows, boolean()} โ€” whether the rows already chillin' in the grid get resized too

This will only affect rows subsequently added to the grid unless resizeExistingRows is true. Same rules as the column one, just rotated 90 degrees ๐Ÿ˜Œ

If height is less than getRowMinimalAcceptableHeight/1, then the minimal acceptable height is used instead of it. No going under the floor, bestie ๐Ÿ’€

setGridCursor(This, Coords) -> ok

Types:

This = wxGrid()
Coords = {R :: integer(), C :: integer()}

Set the grid cursor to the specified cell. ๐Ÿ‘‘

The grid cursor is basically the main character of the grid โ€” it indicates the current cell, and the user can move it with the arrow keys or the mouse ๐Ÿ–ฑ๏ธโŒจ๏ธ

Calling this function generates a wxEVT_GRID_SELECT_CELL event, and if the event handler vetoes this event, the cursor is not moved. The handler said no, so it's a no ๐Ÿ™ˆ

Also, this function doesn't make the target cell visible โ€” use GoToCell() (not implemented in wx) to actually do that. (The original text says "target call" which is the cutest typo ever, but likeโ€ฆ it means the cell ๐Ÿ’…)

setGridCursor(This, Row, Col) -> ok

Types:

This = wxGrid()
Row = Col = integer()

Set the grid cursor to the specified cell. Same story, but you spell out Row and Col yourself ๐Ÿฆ‹

The grid cursor indicates the current cell and can be moved by the user using the arrow keys or the mouse. ๐Ÿ–ฑ๏ธ

Calling this function generates a wxEVT_GRID_SELECT_CELL event and if the event handler vetoes this event, the cursor is not moved. Veto power is real ๐Ÿ’€

This function doesn't make the target cell visible โ€” use GoToCell() (not implemented in wx) to do this. Periodt.

setGridLineColour(This, Colour) -> ok

Types:

This = wxGrid()
Colour = wx:wx_colour()

Sets the colour used to draw grid lines. The grid's little eyeliner โœจ๐ŸŒˆ

setLabelBackgroundColour(This, Colour) -> ok

Types:

This = wxGrid()
Colour = wx:wx_colour()

Sets the background colour for row and column labels. Outfit change for the labels ๐ŸŽ€

setLabelFont(This, Font) -> ok

Types:

This = wxGrid()
Font = wxFont:wxFont()

Sets the font for row and column labels. Glow-up for the headers ๐Ÿ’…

setLabelTextColour(This, Colour) -> ok

Types:

This = wxGrid()
Colour = wx:wx_colour()

Sets the colour for row and column label text. ๐Ÿ–๏ธ

setMargins(This, ExtraWidth, ExtraHeight) -> ok

Types:

(and the types stop right there โ€” to be continued in the next part, bestie ๐Ÿ’–๐Ÿฆ‹)

picking up mid-types, the spec ends with:

This = wxGrid()
ExtraWidth = ExtraHeight = integer()

and it sets the extra margins used around the grid area ๐Ÿ’…. A grid may occupy more space than needed for its data display, and this function allows setting how big this extra space is. Cute, right? โœจ

setReadOnly(This, Row, Col) -> ok

Types:

This = wxGrid()
Row = Col = integer()

setReadOnly(This, Row, Col, Options :: [Option]) -> ok

Types:

This = wxGrid()
Row = Col = integer()
Option = {isReadOnly, boolean()}

Makes the cell at the specified location read-only or editable. See: isReadOnly/3.


setRowAttr(This, Row, Attr) -> ok

Types:

This = wxGrid()
Row = integer()
Attr = wxGridCellAttr:wxGridCellAttr()

Sets the cell attributes for all cells in the specified row. The grid takes ownership of the attribute pointer ๐Ÿซถ โ€” yes, that part matters. See the wxGridCellAttr class for more information about controlling cell attributes.

setRowLabelAlignment(This, Horiz, Vert) -> ok

Types:

This = wxGrid()
Horiz = Vert = integer()

Sets the horizontal and vertical alignment of row label text. Horizontal alignment should be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. Vertical alignment should be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. Slay those labels into place ๐Ÿ’….

setRowLabelSize(This, Width) -> ok

Types:

This = wxGrid()
Width = integer()

Sets the width of the row labels. If Width equals wxGRID_AUTOSIZE then width is calculated automatically so that no label is truncated. Note that this could be slow for a large table โ€” not me warning you, the docs are ๐Ÿซถ.

setRowLabelValue(This, Row, Value) -> ok

Types:

This = wxGrid()
Row = integer()
Value = unicode:chardata()

Sets the value for the given row label. If you are using a derived grid table you must override wxGridTableBase::SetRowLabelValue() (not implemented in wx) for this to have any effect. iykyk ๐Ÿ˜ญ.

setRowMinimalHeight(This, Row, Height) -> ok

Types:

This = wxGrid()
Row = Height = integer()

Sets the minimal height for the specified row. See setColMinimalWidth/3 for more information.

setRowMinimalAcceptableHeight(This, Height) -> ok

Types:

This = wxGrid()
Height = integer()

Sets the minimal row height used by default. See setColMinimalAcceptableWidth/2 for more information.

setRowSize(This, Row, Height) -> ok

Types:

This = wxGrid()
Row = Height = integer()

Sets the height of the specified row. See setColSize/3 for more information.


setScrollLineX(This, X) -> ok

Types:

This = wxGrid()
X = integer()

Sets the number of pixels per horizontal scroll increment. The default is 15. See: getScrollLineX/1, getScrollLineY/1, setScrollLineY/2.

setScrollLineY(This, Y) -> ok

Types:

This = wxGrid()
Y = integer()

Sets the number of pixels per vertical scroll increment. The default is 15. See: getScrollLineX/1, getScrollLineY/1, setScrollLineX/2.

setSelectionBackground(This, C) -> ok

Types:

This = wxGrid()
C = wx:wx_colour()

Set the colour to be used for drawing the selection background. Aesthetic upgrade unlocked ๐ŸŒˆ.

setSelectionForeground(This, C) -> ok

Types:

This = wxGrid()
C = wx:wx_colour()

Set the colour to be used for drawing the selection foreground. Matchy-matchy bestie energy ๐ŸŽ€.

setSelectionMode(This, Selmode) -> ok

Types:

This = wxGrid()
Selmode = wx:wx_enum()

Set the selection behaviour of the grid. The existing selection is converted to conform to the new mode if possible and discarded otherwise (e.g. any individual selected cells are deselected if the new mode allows only the selection of the entire rows or columns). Itโ€™s giving โ€œglow-up with consequencesโ€ ๐Ÿ’€.


showCellEditControl(This) -> ok

Types:

This = wxGrid()

Displays the active in-place cell edit control for the current cell after it was hidden. This method should only be called after calling hideCellEditControl/1; to start editing the current grid cell use enableCellEditControl/2 instead.

xToCol(This, X) -> integer()

Types:

This = wxGrid()
X = integer()

xToCol(This, X, Options :: [Option]) -> integer()

Types:

This = wxGrid()
X = integer()
Option = {clipToMinMax, boolean()}

Returns the column at the given pixel position depending on the window. Return: The column index or wxNOT_FOUND.

xToEdgeOfCol(This, X) -> integer()

Types:

This = wxGrid()
X = integer()

Returns the column whose right hand edge is close to the given logical x position. If no column edge is near to this position wxNOT_FOUND is returned.

yToEdgeOfRow(This, Y) -> integer()

Types:

This = wxGrid()
Y = integer()

Returns the row whose bottom edge is close to the given logical y position. If no row edge is near to this position wxNOT_FOUND is returned.

yToRow(This, Y) -> integer()

Types:

This = wxGrid()
Y = integer()

yToRow(This, Y, Options :: [Option]) -> integer()

Types:

This = wxGrid()
Y = integer()
Option = {clipToMinMax, boolean()}

Returns the grid row that corresponds to the logical y coordinate. The parameter gridWindow is new since wxWidgets 3.1.3. If it is specified, i.e. non-NULL, only the cells of this window are considered, i.e. the function returns wxNOT_FOUND if y is out of bounds. If gridWindow is NULL, the function returns wxNOT_FOUND only if there is no row at all at the y position. Bestie, thatโ€™s the whole vibe check โœ….

okay thatโ€™s literally the whole page! ๐Ÿ’– Big ups to the wxWidgets team, footer says wx 2.2.2.1, page wxGrid(3erl) โ€” periodt. โœจ

๐Ÿ“ฆ where this page comes from