wxGrid(3)
β¨ wxGrid β¨
okay so bestie, welcome to wxGrid(3) β yes, the Erlang module definition, and yes, it's giving main character energy for tabular data. π
πΈ NAME πΈ
wxGrid β wxGrid and its related classes are used for displaying and editing tabular data.
π¦ DESCRIPTION π¦
They provide a rich set of features for display, editing, and interacting with a variety of data sources. For simple applications, and 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. 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.
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:
wxGridCellBoolRendererwxGridCellFloatRendererwxGridCellNumberRendererwxGridCellStringRendererwxGridCellDateRenderer(not implemented in wx)wxGridCellDateTimeRenderer(not implemented in wx)
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:
wxGridCellBoolEditorwxGridCellChoiceEditorwxGridCellFloatEditorwxGridCellNumberEditorwxGridCellTextEditorwxGridCellDateEditor(not implemented in wx)
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
This class is derived, and can use functions, from:
wxScrolledWindowwxPanelwxWindowwxEvtHandler
wxWidgets docs: wxGrid
π DATA TYPES π
wxGrid() :: wx:wx_object().
π₯ FUNCTIONS π₯
appendCols/2
appendCols(This, [Option]) -> boolean()
when
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.
appendRows/2
appendRows(This, [Option]) -> boolean()
when
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.
autoSize/1
autoSize(This) -> ok when This :: wxGrid().
Automatically sets the height and width of all rows and columns to fit their contents.
autoSizeColumn/3
autoSizeColumn(This, Col, [Option]) -> ok
when
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.
autoSizeColumns/2
autoSizeColumns(This, [Option]) -> ok
when
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.
autoSizeRow/3
autoSizeRow(This, Row, [Option]) -> ok
when
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.
autoSizeRows/2
autoSizeRows(This, [Option]) -> ok
when
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.
beginBatch/1
beginBatch(This) -> ok when 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.
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.
blockToDeviceRect/3
blockToDeviceRect(This, TopLeft, BottomRight) ->
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()}
when
This :: wxGrid(),
TopLeft ::
{R :: integer(), C :: integer()},
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.
Since: 3.1.3 Parameter gridWindow has been added.
See: cellToRect/3
canDragCell/1
canDragCell(This) -> boolean() when This :: wxGrid().
Return true if the dragging of cells is enabled or false otherwise.
canDragColMove/1
canDragColMove(This) -> boolean() when This :: wxGrid().
Returns true if columns can be moved by dragging with the mouse.
Columns can be moved by dragging on their labels.
canDragColSize/2
canDragColSize(This, Col) -> boolean()
when 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).
canDragGridRowEdges/1
canDragGridRowEdges(This) -> boolean() when This :: wxGrid().
Return true if row edges inside the grid can be dragged to resize the rows.
See:
canDragGridSize/1canDragRowSize/2
Since: 3.1.4
canDragGridSize/1
canDragGridSize(This) -> boolean() when This :: wxGrid().
Return true if the dragging of grid lines to resize rows and columns is enabled or false otherwise.
canDragRowSize/2
canDragRowSize(This, Row) -> boolean()
when 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.
canEnableCellControl/1
canEnableCellControl(This) -> boolean() when 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.
cellToRect/2
cellToRect(This, Coords) ->
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()}
when
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/3
cellToRect(This, Row, Col) ->
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()}
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
Return the rectangle corresponding to the grid cell's size and position in logical coordinates.
See: blockToDeviceRect/3
clearGrid/1
clearGrid(This) -> ok when This :: wxGrid().
Clears all data in the underlying grid table and repaints the grid.
The table is not deleted by this function. If you are using a derived table class then you need to override wxGridTableBase::Clear() (not implemented in wx) for this function to have any effect.
clearSelection/1
clearSelection(This) -> ok when This :: wxGrid().
Deselects all cells that are currently selected.
createGrid/4
createGrid(This, NumRows, NumCols, [Option]) -> boolean()
when
This :: wxGrid(),
NumRows :: integer(),
NumCols :: integer(),
Option :: {selmode, wx:wx_enum()}.
Creates a grid with the specified initial number of rows and columns.
Okay so call this bad boy right after the grid constructor. When you use this function, wxGrid is gonna create and manage a lil' simple table of string values for you, and all the grid data lives in memory. β¨
But if your app has more complex data types or relationships, or you're dealing with very large datasets, you should lowkey 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). iykyk.
deleteCols
deleteCols(This, [Option]) -> boolean()
when
This :: wxGrid(),
Option ::
{pos, integer()} |
{numCols, integer()} |
{updateLabels, boolean()}.
Deletes one or more columns from a grid starting at the specified position. π
The updateLabels argument is not used at present. If you're using a derived grid table class you will 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
deleteRows(This, [Option]) -> boolean()
when
This :: wxGrid(),
Option ::
{pos, integer()} |
{numRows, integer()} |
{updateLabels, boolean()}.
Deletes one or more rows from a grid starting at the specified position. π«Ά
The updateLabels argument is not used at present. If you're using a derived grid table class you will 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.
destroy
destroy(This :: wxGrid()) -> ok.
Destroys the object. π
disableCellEditControl
disableCellEditControl(This) -> ok when This :: wxGrid().
Disables in-place editing of grid cells.
Equivalent to calling EnableCellEditControl(false).
disableDragColSize
disableDragColSize(This) -> ok when This :: wxGrid().
Disables column sizing by dragging with the mouse.
Equivalent to passing false to enableDragColSize/2.
disableDragGridSize
disableDragGridSize(This) -> ok when This :: wxGrid().
Disable mouse dragging of grid lines to resize rows and columns.
Equivalent to passing false to enableDragGridSize/2
disableDragRowSize
disableDragRowSize(This) -> ok when This :: wxGrid().
Disables row sizing by dragging with the mouse.
Equivalent to passing false to enableDragRowSize/2.
enableCellEditControl
enableCellEditControl(This, [Option]) -> ok
when
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 allows the user to 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.
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.
enableDragColSize
enableDragColSize(This, [Option]) -> ok
when
This :: wxGrid(),
Option :: {enable, boolean()}.
Enables or disables column sizing by dragging with the mouse.
enableDragGridSize
enableDragGridSize(This, [Option]) -> ok
when
This :: wxGrid(),
Option :: {enable, boolean()}.
Enables or disables row and column resizing by dragging gridlines with the mouse.
enableDragRowSize
enableDragRowSize(This, [Option]) -> ok
when
This :: wxGrid(),
Option :: {enable, boolean()}.
Enables or disables row sizing by dragging with the mouse.
enableEditing
enableEditing(This, Edit) -> ok
when 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
enableGridLines(This, [Option]) -> ok
when
This :: wxGrid(),
Option :: {enable, boolean()}.
Turns the drawing of grid lines on or off.
endBatch
endBatch(This) -> ok when This :: wxGrid().
Decrements the grid's batch count.
When the count is greater than zero repainting of the grid is suppressed. Each previous call to beginBatch/1 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 will cause the grid to be repainted.
fit
fit(This) -> ok when This :: wxGrid().
Overridden wxWindow method.
forceRefresh
forceRefresh(This) -> ok when This :: wxGrid().
Causes immediate repainting of the grid.
Use this instead of the usual wxWindow:refresh/2.
getBatchCount
getBatchCount(This) -> integer() when 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.
getCellAlignment
getCellAlignment(This, Row, Col) ->
{Horiz :: integer(), Vert :: integer()}
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
Sets the arguments to the horizontal and vertical text alignment values for the grid cell at the specified location.
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
getCellBackgroundColour(This, Row, Col) -> wx:wx_colour4()
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
Returns the background colour of the cell at the specified location.
getCellEditor
getCellEditor(This, Row, Col) ->
wxGridCellEditor:wxGridCellEditor()
when
This :: wxGrid(),
Row :: integer(),
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.
The caller must call DecRef() on the returned pointer.
getCellFont
getCellFont(This, Row, Col) -> wxFont:wxFont()
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
Returns the font for text in the grid cell at the specified location.
getCellRenderer
getCellRenderer(This, Row, Col) ->
wxGridCellRenderer:wxGridCellRenderer()
when
This :: wxGrid(),
Row :: integer(),
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.
The caller must call DecRef() on the returned pointer.
getCellTextColour
getCellTextColour(This, Row, Col) -> wx:wx_colour4()
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
Returns the text colour for the grid cell at the specified location.
getCellValue (Coords version)
getCellValue(This, Coords) -> unicode:charlist()
when
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 have 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.
See wxGridTableBase::CanGetValueAs() (not implemented in wx) and the overview_grid for more information.
getCellValue (Row, Col version)
getCellValue(This, Row, Col) -> unicode:charlist()
when
This :: wxGrid(),
Row :: integer(),
Col :: 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 have 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.
See wxGridTableBase::CanGetValueAs() (not implemented in wx) and the overview_grid for more information.
getColLabelAlignment(This)β{Horiz :: integer(), Vert :: integer()}whenThis :: wxGrid(). β Drops the current column label alignment values into the arguments, 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.
getColLabelSize(This)βinteger()whenThis :: wxGrid(). β Hands you the current height of the column labels. β¨getColLabelValue(This, Col)βunicode:charlist()whenThis :: wxGrid(),Col :: integer(). β Gives you back the label for that specific column, fr fr.
The default grid table class provides column labels of the form A,B...Z,AA,AB...ZZ,AAA... If you're running a custom grid table you can override wxGridTableBase::GetColLabelValue() (not implemented in wx) to serve your own labels. π
getColMinimalAcceptableWidth(This)βinteger()whenThis :: wxGrid(). β Returns the minimal width a column can be resized down to. No shrinking past this, periodt.
Use setColMinimalAcceptableWidth/2 to change this value globally or setColMinimalWidth/3 to do it for individual columns.
See: getRowMinimalAcceptableHeight/1
getDefaultCellAlignment(This)β{Horiz :: integer(), Vert :: integer()}whenThis :: wxGrid(). β Returns the default cell alignment, as a little pair of values.
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()whenThis :: wxGrid(). β Returns the current default background colour for grid cells. The canvas before anything's painted on it, yk? π¨getDefaultCellFont(This)βwxFont:wxFont()whenThis :: wxGrid(). β Returns the current default font for grid cell text.getDefaultCellTextColour(This)βwx:wx_colour4()whenThis :: wxGrid(). β Returns the current default colour for grid cell text.getDefaultColLabelSize(This)βinteger()whenThis :: wxGrid(). β Returns the default height for column labels.getDefaultColSize(This)βinteger()whenThis :: wxGrid(). β Returns the current default width for grid columns.getDefaultEditor(This)βwxGridCellEditor:wxGridCellEditor()whenThis :: wxGrid(). β Returns a pointer to the current default grid cell editor. π
See wxGridCellEditor and the overview_grid for more information about cell editors and renderers.
getDefaultEditorForCell(This, C)βwxGridCellEditor:wxGridCellEditor()whenThis :: wxGrid(),C :: {R :: integer(), C :: integer()}. β 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 the 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. β οΈ Don't forget her, she's ref-counted!
getDefaultEditorForCell(This, Row, Col)βwxGridCellEditor:wxGridCellEditor()whenThis :: wxGrid(),Row :: integer(),Col :: integer(). β Same deal, just withRowandColhanded over separately instead of bundled in a tuple. 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 the 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. β οΈ
getDefaultEditorForType(This, TypeName)βwxGridCellEditor:wxGridCellEditor()whenThis :: wxGrid(),TypeName :: unicode:chardata(). β Returns the default editor for the cells containing values of the given type.
The base class version returns the editor which was associated with the specified typeName when it was registered registerDataType/4 but this function may be overridden to return something different. This allows overriding an editor used for one of the standard types.
The caller must call DecRef() on the returned pointer. β οΈ
getDefaultRenderer(This)βwxGridCellRenderer:wxGridCellRenderer()whenThis :: wxGrid(). β Returns a pointer to the current default grid cell renderer.
See wxGridCellRenderer and the overview_grid for more information about cell editors and renderers.
The caller must call DecRef() on the returned pointer. β οΈ
getDefaultRendererForCell(This, Row, Col)βwxGridCellRenderer:wxGridCellRenderer()whenThis :: wxGrid(),Row :: integer(),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 the derived classes to use custom renderers for some cells by default.
The caller must call DecRef() on the returned pointer. β οΈ
getDefaultRendererForType(This, TypeName)βwxGridCellRenderer:wxGridCellRenderer()whenThis :: wxGrid(),TypeName :: unicode:chardata(). β Returns the default renderer for the cell containing values of the given type.
See: getDefaultEditorForType/2
getDefaultRowLabelSize(This)βinteger()whenThis :: wxGrid(). β Returns the default width for the row labels.getDefaultRowSize(This)βinteger()whenThis :: wxGrid(). β Returns the current default height for grid rows.getGridColLabelWindow(This)βwxWindow:wxWindow()whenThis :: 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()whenThis :: wxGrid(). β Return the window in the top left grid corner.
This window is shown only of 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. The main character energy of corners, honestly. β¨
getGridCursorCol(This)βinteger()whenThis :: wxGrid(). β Returns the current grid cell column position.getGridCursorRow(This)βinteger()whenThis :: wxGrid(). β Returns the current grid cell row position.getGridLineColour(This)βwx:wx_colour4()whenThis :: wxGrid(). β Returns the colour used for grid lines.getGridRowLabelWindow(This)βwxWindow:wxWindow()whenThis :: wxGrid(). β Return the row labels window.
This window is not shown if the row labels were hidden using HideRowLabels() (not implemented in wx).
getGridWindow(This)βwxWindow:wxWindow()whenThis :: wxGrid(). β Return the main grid window containing the grid cells.
This window is always shown. No hiding, she's booked and busy. π
getLabelBackgroundColour(This)βwx:wx_colour4()whenThis :: wxGrid(). β Returns the colour used for the background of row and column labels.getLabelFont(This)βwxFont:wxFont()whenThis :: wxGrid(). β Returns the font used for row and column labels.getLabelTextColour(This)βwx:wx_colour4()whenThis :: wxGrid(). β Returns the colour used for row and column label text.getNumberCols(This)βinteger()whenThis :: wxGrid(). β Returns the total number of grid columns.
This is the same as the number of columns in the underlying grid table.
getNumberRows(This)βinteger()whenThis :: wxGrid(). β Returns the total number of grid rows.
This is the same as the number of rows in the underlying grid table.
getOrCreateCellAttr(This, Row, Col)βwxGridCellAttr:wxGridCellAttr()whenThis :: wxGrid(),Row :: integer(),Col :: integer(). β Returns the attribute for the given cell creating one if necessary. β¨
If the cell already has an attribute, it is returned. Otherwise a new attribute is created, associated with the cell and returned. In any case the caller must call DecRef() on the returned pointer.
Prefer to use GetOrCreateCellAttrPtr() (not implemented in wx) to avoid the need to call DecRef() on the returned pointer.
This function may only be called if CanHaveAttributes() (not implemented in wx) returns true. π¨ Otherwise? Nope, not allowed, no cap.
getRowLabelAlignment(This)β{Horiz :: integer(), Vert :: integer()}whenThis :: wxGrid().
the alignment used for row labels β¨ β and yes, it comes in two flavours, bestie:
Horizontal alignment be one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. π
Vertical alignment be one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. π
(and no, that's not a typo, it's spelled CENTRE, we're fancy like that π)
getRowLabelSize(This) -> integer()whenThis :: wxGrid().β hands you the current width of the row labels, periodt. πgetRowLabelValue(This, Row) -> unicode:charlist()whenThis :: wxGrid(), Row :: integer().β gives you back the label for that specific row, bestie.
The default grid table class ships with numeric row labels. But if you're out here with a custom grid table, you can override wxGridTableBase::GetRowLabelValue() (not implemented in wx) and supply your own labels β customisation era π
getRowMinimalAcceptableHeight(This) -> integer()whenThis :: wxGrid().β returns the minimal size that rows can be resized down to. Like, the floor, the absolute limit, the "don't test me" height. π ββοΈ
Wanna change it? Use setRowMinimalAcceptableHeight/2 to do it globally, or setRowMinimalHeight/3 to do it for individual cells. iykyk.
See also: getColMinimalAcceptableWidth/1
getRowSize(This, Row) -> integer()whenThis :: wxGrid(), Row :: integer().β the height of the row you asked about. Simple. Iconic. πΈgetScrollLineX(This) -> integer()whenThis :: wxGrid().β returns the number of pixels per horizontal scroll increment. π
The default is 15.
See:
getScrollLineY/1setScrollLineX/2setScrollLineY/2
getScrollLineY(This) -> integer()whenThis :: wxGrid().β returns the number of pixels per vertical scroll increment. π¦
The default is 15.
See:
getScrollLineX/1setScrollLineX/2setScrollLineY/2
getSelectedCells(This) -> [{R :: integer(), C :: integer()}]whenThis :: wxGrid().β returns an array of the cells that were selected individually. π―
Careful, girl. This array does not contain all the selected cells in general β it doesn't include cells selected as part of a column, row or block selection. To get the whole selection you have to use this method plusgetSelectedCols/1,getSelectedRows/1,getSelectionBlockTopLeft/1andgetSelectionBlockBottomRight/1. All of them. Together. The full squad. π
And this behaviour is by design, not a bug, fr fr β it's needed so grids of arbitrary size can exist. Picture a grid with a million columns and someone selects an entire column: we are not about to build you an array with a million entries in this function. So instead it returns an empty array, and getSelectedCols/1 hands back an array with just one element in it. Efficiency queen. π
Heads up: this function can be slow on big grids, so use GetSelectedBlocks() (not implemented in wx) in new code. π
getSelectedCols(This) -> [integer()]whenThis :: wxGrid().β returns an array of the selected columns. ποΈ
But ngl, this method alone is not enough to find all the selected columns β it only contains the ones that were individually selected, not the ones that are part of a block selection, and not the ones that count as selected just because all of their cells got selected one by one. Peep getSelectedCells/1 for the full tea. π«
Can be slow on big grids β use GetSelectedBlocks() (not implemented in wx) in the new code.
getSelectedRows(This) -> [integer()]whenThis :: wxGrid().β returns an array of the selected rows. π
Same deal, bestie: this method alone won't find all the selected rows, because it only holds the rows picked individually β not the ones inside a block selection, and not the ones that are selected just because every single one of their cells was selected individually. Go read getSelectedCells/1 for the details. π
Can be slow on big grids β use GetSelectedBlocks() (not implemented in wx) in the new code.
getSelectionBackground(This) -> wx:wx_colour4()whenThis :: wxGrid().β the colour used to paint the selection background. π¨getSelectionBlockBottomRight(This) -> [{R :: integer(), C :: integer()}]whenThis :: wxGrid().β returns an array of the bottom-right corners of the blocks of selected cells. π
Please check getSelectedCells/1 for more info on how wxGrid represents selections.
Can be slow on big grids β use GetSelectedBlocks() (not implemented in wx) in the new code.
See: getSelectionBlockTopLeft/1
getSelectionBlockTopLeft(This) -> [{R :: integer(), C :: integer()}]whenThis :: wxGrid().β returns an array of the top-left corners of the blocks of selected cells. π
Same as above, getSelectedCells/1 has the full story on selection representation in wxGrid.
Can be slow on big grids β use GetSelectedBlocks() (not implemented in wx) in the new code.
See: getSelectionBlockBottomRight/1
getSelectionForeground(This) -> wx:wx_colour4()whenThis :: wxGrid().β the colour used for the selection foreground. β¨gridLinesEnabled(This) -> boolean()whenThis :: wxGrid().β returnstrueif grid line drawing is switched on,falseif it's not. πͺhideCellEditControl(This) -> okwhenThis :: wxGrid().β hides the in-place cell edit control. Poof. Gone. πinsertCols(This, [Option]) -> boolean()
when
This :: wxGrid(),
Option ::
{pos, integer()} |
{numCols, integer()} |
{updateLabels, boolean()}.
Inserts one or more new columns into the grid, with the first new column landing at the position you specify. π±
Heads up though: inserting columns requires grid table cooperation. When this method is called, the grid object starts by asking the underlying grid table to insert the new columns. If that works out, the table notifies the grid and the grid refreshes the display. For a default grid (one where you called createGrid/4) this whole process is automatic, slay. But if you're running a custom grid table (set via 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. No override, no columns. π€·ββοΈ
Return: true if the columns were successfully inserted, false if an error happened (most likely the table couldn't be updated). π
insertRows(This, [Option]) -> boolean()
when
This :: wxGrid(),
Option ::
{pos, integer()} |
{numRows, integer()} |
{updateLabels, boolean()}.
Inserts one or more new rows into the grid, first new row at the position you give it. π·
And just like with columns, you must implement wxGridTableBase::InsertRows() (not implemented in wx) if you're using a grid with a custom table β go read insertCols/2 for the whole explanation, bestie.
Return: true if the rows were successfully inserted, false if an error happened (most likely the table couldn't be updated). π
isCellEditControlEnabled(This) -> boolean()whenThis :: wxGrid().βtrueif the in-place edit control is currently enabled. βisCurrentCellReadOnly(This) -> boolean()whenThis :: wxGrid().βtrueif the current cell is read-only. π
See:
setReadOnly/4isReadOnly/3
isEditable(This) -> boolean()whenThis :: wxGrid().β returnsfalseif the entire grid has been marked read-only, andtrueotherwise. π
See enableEditing/2 for more on controlling the editing status of grid cells.
isInSelection(This, Coords) -> boolean()
when
This :: wxGrid(),
Coords :: {R :: integer(), C :: integer()}.
true if the given cell is selected. π―
isInSelection(This, Row, Col) -> boolean()
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
true if the given cell is selected. (yes, same answer, two ways in β we love options π
)
isReadOnly(This, Row, Col) -> boolean()
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
true if the cell at the location you named can't be edited. π
See:
setReadOnly/4isCurrentCellReadOnly/1
isSelection(This) -> boolean()whenThis :: wxGrid().βtrueif there are currently any selected cells, rows, columns or blocks. Literally anything selected. πisVisible(This, Row, Col) -> boolean()
when
This :: wxGrid(),
Row :: integer(),
Col :: integer();
(This, Coords, [Option]) -> boolean()
when
This :: wxGrid(),
Coords :: {R :: integer(), C :: integer()},
Option :: {wholeCellVisible, boolean()}.
true if a cell is either entirely or at least partially visible in the grid window. πͺ
By default the cell has to be entirely visible for this to return true β but if wholeCellVisible is false, then it returns true even when the cell is only partially visible. Compromise era. π€
isVisible(This, Row, Col, [Option]) -> boolean()
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
Option :: {wholeCellVisible, boolean()}.
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 to return true, but if wholeCellVisible is false, the function returns true even if the cell is only partially visible.
makeCellVisible π
Two flavors, both hand back ok.
makeCellVisible(This, Coords) -> ok
when
This :: wxGrid(),
Coords :: {R :: integer(), C :: integer()}.
okay so this one brings the cell you point at into the visible grid cell area using the least amount of scrolling humanly possible. Minimal scrolling, no drama, no theatrics. And if the cell is already visible? It does nothing. Literally nothing. Not a pixel moves. π
makeCellVisible(This, Row, Col) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
same exact energy, except you hand it Row and Col as two separate ints instead of one cute little tuple. Brings the cell into the visible area with minimal scrolling, and once again β already visible means nothing happens. π¦
moveCursorDown β¬οΈ
moveCursorDown(This, ExpandSelection) -> boolean()
when
This :: wxGrid(),
ExpandSelection :: boolean().
nudges the grid cursor down by one row. and here's the tea: if a block of cells was selected before, it will expand when the argument is true, or get cleared when the argument is false. pick your fighter. β¨
moveCursorDownBlock
moveCursorDownBlock(This, ExpandSelection) -> boolean()
when
This :: wxGrid(),
ExpandSelection :: boolean().
this one also goes down, but in the current column specifically, and it skips all the way to the beginning or the end of a block of non-empty cells. very block-aware, very demure. π
and yep, same rule as always: previously selected block expands if the argument is true, gets cleared if it's false.
moveCursorLeft β¬
οΈ
moveCursorLeft(This, ExpandSelection) -> boolean()
when
This :: wxGrid(),
ExpandSelection :: boolean().
moves the grid cursor left by one column. and, once again for the people in the back: a previously selected block of cells will expand if the argument is true, or be cleared if it's false. π
moveCursorLeftBlock
moveCursorLeftBlock(This, ExpandSelection) -> boolean()
when
This :: wxGrid(),
ExpandSelection :: boolean().
goes left, but in the current row, skipping to the beginning or end of a block of non-empty cells. it's giving "jump to the edge of the vibe".
same deal as its siblings: block selected before β expands on true, cleared on false. π
moveCursorRight β‘οΈ
moveCursorRight(This, ExpandSelection) -> boolean()
when
This :: wxGrid(),
ExpandSelection :: boolean().
moves the grid cursor right by one column. if a block of cells was previously selected it will expand when the argument is true, and be cleared when the argument is false. no cap. π₯
moveCursorRightBlock
moveCursorRightBlock(This, ExpandSelection) -> boolean()
when
This :: wxGrid(),
ExpandSelection :: boolean().
moves the grid cursor right within the current row, skipping to the beginning or end of a block of non-empty cells.
and once more, because consistency is iconic: previous selection expands if the argument is true, gets cleared if it's false. π
moveCursorUp β¬οΈ
moveCursorUp(This, ExpandSelection) -> boolean()
when
This :: wxGrid(), ExpandSelection :: boolean().
moves the grid cursor up by one row. and yes babes, the eternal rule applies β a block of cells that was previously selected will expand if the argument is true, or be cleared if the argument is false. πΈ
moveCursorUpBlock
moveCursorUpBlock(This, ExpandSelection) -> boolean()
when
This :: wxGrid(),
ExpandSelection :: boolean().
moves the grid cursor up in the current column, such that it skips to the beginning or end of a block of non-empty cells.
and (last time, promise, it's literally the same sentence) a previously selected block expands on true and clears on false. π§
movePageDown πβ¬οΈ
movePageDown(This) -> boolean() when This :: wxGrid().
moves the grid cursor down by some number of rows β specifically so that the row that used to be the bottom visible row becomes the top visible row. full page-flip energy. π
movePageUp πβ¬οΈ
movePageUp(This) -> boolean() when This :: wxGrid().
moves the grid cursor up by some number of rows β so that the previous top visible row becomes the bottom visible row. the mirror move, the yin to movePageDown's yang. π
new π±
the no-argument era:
new() -> wxGrid().
the Default constructor. a blank canvas. the β¨potentialβ¨. but bestie, listen carefully:
β οΈ You must callCreate()(not implemented in wx) to really create the grid window, and you also have to callcreateGrid/4orSetTable()(not implemented in wx) orAssignTable()(not implemented in wx) to initialize its contents. Until then you're just holding a vibe with no grid in it. π
and the one where you actually tell it what it is:
new(Parent, Id, [Option]) -> wxGrid()
when
Parent :: wxWindow:wxWindow(),
Id :: integer(),
Option ::
{pos, {X :: integer(), Y :: integer()}} |
{size, {W :: integer(), H :: integer()}} |
{style, integer()}.
this is the constructor that creates the grid window. π and even here β yeah, still β 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. periodt. π
registerDataType π§¬
registerDataType(This, TypeName, Renderer, Editor) -> ok
when
This :: wxGrid(),
TypeName :: unicode:chardata(),
Renderer ::
wxGridCellRenderer:wxGridCellRenderer(),
Editor ::
wxGridCellEditor:wxGridCellEditor().
registers a brand new data type. and this is genuinely such a cool mechanic, so let me explain it properly:
data types let you naturally associate specific renderers and editors with the cells that hold values of a given type. like, for example β the grid automatically registers a data type named wxGRID_VALUE_STRING which uses wxGridCellStringRenderer and wxGridCellTextEditor as its renderer and editor respectively. that's the data type used by all the cells of the default wxGridStringTable (not implemented in wx), so this renderer and editor are the ones used by default for all grid cells. iconic behaviour, honestly.
but say a custom table returns wxGRID_VALUE_BOOL from its wxGridTableBase::GetTypeName() (not implemented in wx) method β then wxGridCellBoolRenderer and wxGridCellBoolEditor get used for it instead, because the grid also registers a boolean data type under that name. see how it works? π
and since this whole mechanism is completely generic, you can register your own custom data types using your own renderers and editors. just remember the one golden rule: the table must identify a cell as being of the given type for them to actually be used for that cell. no tag, no renderer. π«Ά
saveEditControlValue πΎ
saveEditControlValue(This) -> ok when This :: wxGrid().
sets the value of the current grid cell to the current in-place edit control value. translation: "ok commit that, we're done editing". βοΈ
this gets called automatically whenever the grid cursor moves off the current cell onto a new one. it is also a really good idea to call this function yourself when you're closing a grid, because any edits to the final cell location will not be saved otherwise.
π do not lose your last edit bestie. call it. save it. you deserve it.
selectAll π
selectAll(This) -> ok when This :: wxGrid().
selects all the cells in the grid. every single one. the whole thing. select all, no crumbs. π
selectBlock (the tuple edition) π§±
selectBlock(This, TopLeft, BottomRight, [Option]) -> ok
when
This :: wxGrid(),
TopLeft :: {R :: integer(), C :: integer()},
BottomRight :: {R :: integer(), C :: integer()},
Option :: {addToSelected, boolean()}.
selects a rectangular block of cells, corners given as TopLeft and BottomRight tuples.
if addToSelected is false then any existing selection gets deselected; if it's true the column will be added to the existing selection. π
selectBlock (the four-numbers edition)
selectBlock(This, TopRow, LeftCol, BottomRow, RightCol, [Option]) ->
ok
when
This :: wxGrid(),
TopRow :: integer(),
LeftCol :: integer(),
BottomRow :: integer(),
RightCol :: integer(),
Option :: {addToSelected, boolean()}.
same rectangular block of cells, just with the corners spelled out as four separate integers.
and the same rule: addToSelected of false deselects everything else first, true adds the column to the existing selection. β¨
selectCol π
selectCol(This, Col, [Option]) -> ok
when
This :: wxGrid(),
Col :: integer(),
Option :: {addToSelected, boolean()}.
selects the column you specify. if addToSelected is false, any existing selection is deselected first; if true, the column gets added to the existing selection.
heads up tho β this method won't select anything if the current selection mode is wxGridSelectRows. wrong mode, wrong vibe. π
selectRow π
selectRow(This, Row, [Option]) -> ok
when
This :: wxGrid(),
Row :: integer(),
Option :: {addToSelected, boolean()}.
selects the row you specify. addToSelected = false β existing selection gets deselected. addToSelected = true β the row is added to the existing selection.
and same warning, mirrored: this method won't select anything if the current selection mode is wxGridSelectColumns. π
setCellAlignment π
setCellAlignment(This, Row, Col, Horiz, Vert) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
Horiz :: integer(),
Vert :: integer().
sets the horizontal and vertical alignment for the grid cell text at the location you name. π
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.
wxALIGN_CENTRE showing up in both lists? versatile icon behaviour, we love that. π
setCellBackgroundColour π¨
setCellBackgroundColour(This, Row, Col, Colour) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
Colour :: wx:wx_colour().
sets the background colour for the given cell β or all cells by default. yes bestie, paint the whole grid if you want. it's your canvas now. πΈ
setCellEditor/4
setCellEditor(This, Row, Col, Editor) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
Editor ::
wxGridCellEditor:wxGridCellEditor().
Okay so this one hands a brand new editor to the cell at the location you point at π .
- The grid takes ownership of the pointer β like, it's the grid's editor now, bestie, it's not yours anymore π«Ά
PeepwxGridCellEditorandoverview_gridif you wanna know more about cell editors and renderers, fr fr.
setCellFont/4
setCellFont(This, Row, Col, Font) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
Font :: wxFont:wxFont().
Sets the font for text in the grid cell at the specified location β¨. Just vibes, but with a typeface.
setCellRenderer/4
setCellRenderer(This, Row, Col, Renderer) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
Renderer ::
wxGridCellRenderer:wxGridCellRenderer().
Sets the renderer for the grid cell at the specified location π.
- The grid takes ownership of the pointer β yes, again, it's hers now π
CheckwxGridCellRendererandoverview_gridfor more about cell editors and renderers π¦.
setCellTextColour/4
setCellTextColour(This, Row, Col, Colour) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
Colour :: wx:wx_colour().
Sets the text colour for the given cell π. Slap a hue on that text, iconic.
setCellValue/3
setCellValue(This, Coords, S) -> ok
when
This :: wxGrid(),
Coords :: {R :: integer(), C :: integer()},
S :: unicode:chardata().
Sets the string value for 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 getCellValue/3 to access cell values π. For more complex applications where you have 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, no cap.
SeewxGridTableBase::CanSetValueAs()(not implemented in wx) and theoverview_gridfor more information π
setCellValue/4
setCellValue(This, Row, Col, S) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
S :: unicode:chardata().
Sets the string value for the cell at the specified location βοΈ β same energy as above, just the Row/Col flavour instead of the Coords tuple.
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 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, fr fr.
SeewxGridTableBase::CanSetValueAs()(not implemented in wx) and theoverview_gridfor more information πΈ
setColAttr/3
setColAttr(This, Col, Attr) -> ok
when
This :: wxGrid(),
Col :: integer(),
Attr :: wxGridCellAttr:wxGridCellAttr().
Sets the cell attributes for all the cells in the specified column π. The whole column, bestie, every last cell.
For more info about controlling grid cell attributes, see thewxGridCellAttrcell attribute class and theoverview_gridπ
setColFormatBool/2
setColFormatBool(This, Col) -> ok
when This :: wxGrid(), Col :: integer().
Sets the specified column to display boolean values β . True/false girlies, this one's for you.
See: setColFormatCustom/3
setColFormatCustom/3
setColFormatCustom(This, Col, TypeName) -> ok
when
This :: wxGrid(),
Col :: integer(),
TypeName :: unicode:chardata().
Sets the specified column to display data in a custom format π¨.
This method provides an alternative to defining a custom grid table which would return typeName from its GetTypeName() method for the cells in this column: while it doesn't really change the type of the cells in this column, it does associate the renderer and editor used for the cells of the specified type with them. Lowkey clever ngl.
See the overview_grid for more information on working with custom data types π¦
setColFormatFloat/3
setColFormatFloat(This, Col, [Option]) -> ok
when
This :: wxGrid(),
Col :: integer(),
Option ::
{width, integer()} |
{precision, integer()}.
Sets the specified column to display floating point values with the given width and precision π. Decimals, but make them cute.
See: setColFormatCustom/3
setColFormatNumber/2
setColFormatNumber(This, Col) -> ok
when This :: wxGrid(), Col :: integer().
Sets the specified column to display integer values π’. Whole numbers only, periodt.
See: setColFormatCustom/3
setColLabelAlignment/3
setColLabelAlignment(This, Horiz, Vert) -> ok
when
This :: wxGrid(),
Horiz :: integer(),
Vert :: integer().
Sets the horizontal and vertical alignment of column label text π.
- Horizontal alignment should be one of
wxALIGN_LEFT,wxALIGN_CENTREorwxALIGN_RIGHT. - Vertical alignment should be one of
wxALIGN_TOP,wxALIGN_CENTREorwxALIGN_BOTTOM.
setColLabelSize/2
setColLabelSize(This, Height) -> ok
when 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. Heads up though β this could be slow for a large table π.
setColLabelValue/3
setColLabelValue(This, Col, Value) -> ok
when
This :: wxGrid(),
Col :: integer(),
Value :: unicode:chardata().
Set the value for the given column label π·οΈ.
If you are using a custom grid table you must override wxGridTableBase::SetColLabelValue() (not implemented in wx) for this to have any effect. Otherwise it's giving nothing, bestie π
setColMinimalAcceptableWidth/2
setColMinimalAcceptableWidth(This, Width) -> ok
when
This :: wxGrid(),
Width :: integer().
Sets the minimal width to which the user can resize columns π§. Nothing narrower than this, no matter how much they drag.
See: getColMinimalAcceptableWidth/1
setColMinimalWidth/3
setColMinimalWidth(This, Col, Width) -> ok
when
This :: wxGrid(),
Col :: integer(),
Width :: integer().
Sets the minimal width for the specified column col π.
It is usually best to call this method during grid creation, as calling it later will not resize the column to the given minimal width even if it is currently narrower than it. So like... do it early, queen πΈ.
width must be greater than the minimal acceptable column width as returned by getColMinimalAcceptableWidth/1.
setColSize/3
setColSize(This, Col, Width) -> ok
when
This :: wxGrid(),
Col :: integer(),
Width :: integer().
Sets the width of the specified column π. Direct, simple, iconic.
setDefaultCellAlignment/3
setDefaultCellAlignment(This, Horiz, Vert) -> ok
when
This :: wxGrid(),
Horiz :: integer(),
Vert :: integer().
Sets the default horizontal and vertical alignment for grid cell text π.
- Horizontal alignment should be one of
wxALIGN_LEFT,wxALIGN_CENTREorwxALIGN_RIGHT. - Vertical alignment should be one of
wxALIGN_TOP,wxALIGN_CENTREorwxALIGN_BOTTOM.
setDefaultCellBackgroundColour/2
setDefaultCellBackgroundColour(This, Colour) -> ok
when
This :: wxGrid(),
Colour :: wx:wx_colour().
Sets the default background colour for grid cells π. The blank canvas, but make it colorful.
setDefaultCellFont/2
setDefaultCellFont(This, Font) -> ok
when
This :: wxGrid(),
Font :: wxFont:wxFont().
Sets the default font to be used for grid cell text β¨.
setDefaultCellTextColour/2
setDefaultCellTextColour(This, Colour) -> ok
when
This :: wxGrid(),
Colour :: wx:wx_colour().
Sets the current default colour for grid cell text π.
setDefaultColSize/3
setDefaultColSize(This, Width, [Option]) -> ok
when
This :: wxGrid(),
Width :: integer(),
Option :: {resizeExistingCols,
boolean()}.
Sets the default width for columns in the grid π.
This will only affect columns subsequently added to the grid unless resizeExistingCols is true. So like, the existing girlies stay as they are unless you say otherwise π
.
If width is less than getColMinimalAcceptableWidth/1, then the minimal acceptable width is used instead of it.
setDefaultEditor/2
setDefaultEditor(This, Editor) -> ok
when
This :: wxGrid(),
Editor ::
wxGridCellEditor:wxGridCellEditor().
Sets the default editor for grid cells π₯.
- The grid will take ownership of the pointer β you already know the drill π«Ά
SeewxGridCellEditorand theoverview_gridfor more information about cell editors and renderers π
β¨ setDefaultRenderer
setDefaultRenderer(This, Renderer) -> ok
when
This :: wxGrid(),
Renderer :: wxGridCellRenderer:wxGridCellRenderer().
Sets the default renderer for grid cells. π
The grid will take ownership of the pointer β so do not go freeing that thing yourself, bestie, it's not yours anymore.
See wxGridCellRenderer and the overview_grid for more info about cell editors and renderers. iykyk.
π setDefaultRowSize
setDefaultRowSize(This, Height, [Option]) -> ok
when
This :: wxGrid(),
Height :: integer(),
Option :: {resizeExistingRows, boolean()}.
Sets the default height for rows in the grid.
This will only affect rows subsequently added to the grid unless resizeExistingRows is true β so like, new rows only, unless you say otherwise.
If height is less than getRowMinimalAcceptableHeight/1, then the minimal acceptable height is used instead of it. No lower, girl. π«Ά
π setGridCursor
setGridCursor(This, Coords) -> ok
when
This :: wxGrid(),
Coords :: {R :: integer(), C :: integer()}.
setGridCursor(This, Row, Col) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer().
Both of these set the grid cursor to the specified cell. Same energy, two shapes: give it a {R, C} tuple or hand over Row and Col separately. π
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. So the handler has main character energy here and can literally just say no. π
This function doesn't make the target cell visible, use GoToCell() (not implemented in wx) to do this.
π¦ setGridLineColour
setGridLineColour(This, Colour) -> ok
when
This :: wxGrid(),
Colour :: wx:wx_colour().
Sets the colour used to draw grid lines. That's it, that's the whole vibe. β¨
πΈ setLabelBackgroundColour
setLabelBackgroundColour(This, Colour) -> ok
when
This :: wxGrid(),
Colour :: wx:wx_colour().
Sets the background colour for row and column labels.
π setLabelFont
setLabelFont(This, Font) -> ok
when This :: wxGrid(), Font :: wxFont:wxFont().
Sets the font for row and column labels. Glow-up for your headers only. β¨
π setLabelTextColour
setLabelTextColour(This, Colour) -> ok
when
This :: wxGrid(),
Colour :: wx:wx_colour().
Sets the colour for row and column label text.
π§ setMargins
setMargins(This, ExtraWidth, ExtraHeight) -> ok
when
This :: wxGrid(),
ExtraWidth :: integer(),
ExtraHeight :: integer().
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.
π setReadOnly
setReadOnly(This, Row, Col, [Option]) -> ok
when
This :: wxGrid(),
Row :: integer(),
Col :: integer(),
Option :: {isReadOnly, boolean()}.
Makes the cell at the specified location read-only or editable. Lock it or unlock it, your call bestie. π
See: isReadOnly/3
π
setRowAttr
setRowAttr(This, Row, Attr) -> ok
when
This :: wxGrid(),
Row :: integer(),
Attr :: wxGridCellAttr:wxGridCellAttr().
Sets the cell attributes for all cells in the specified row. The whole row, slayed together. β¨
The grid takes ownership of the attribute pointer.
See the wxGridCellAttr class for more information about controlling cell attributes.
π setRowLabelAlignment
setRowLabelAlignment(This, Horiz, Vert) -> ok
when
This :: wxGrid(),
Horiz :: integer(),
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. Pick one from each list, no mix-and-matching random numbers pls. π«Ά
β setRowLabelSize
setRowLabelSize(This, Width) -> ok
when 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 β iconic but lowkey expensive. π
πΈ setRowLabelValue
setRowLabelValue(This, Row, Value) -> ok
when
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.
π¦ setRowMinimalAcceptableHeight
setRowMinimalAcceptableHeight(This, Height) -> ok
when
This :: wxGrid(),
Height :: integer().
Sets the minimal row height used by default.
See setColMinimalAcceptableWidth/2 for more information.
π setRowMinimalHeight
setRowMinimalHeight(This, Row, Height) -> ok
when
This :: wxGrid(),
Row :: integer(),
Height :: integer().
Sets the minimal height for the specified row.
See setColMinimalWidth/3 for more information.
β¨ setRowSize
setRowSize(This, Row, Height) -> ok
when
This :: wxGrid(),
Row :: integer(),
Height :: integer().
Sets the height of the specified row.
See setColSize/3 for more information.
π₯ setScrollLineX
setScrollLineX(This, X) -> ok
when This :: wxGrid(), X :: integer().
Sets the number of pixels per horizontal scroll increment.
The default is 15.
See:
getScrollLineX/1getScrollLineY/1setScrollLineY/2
π₯ setScrollLineY
setScrollLineY(This, Y) -> ok
when This :: wxGrid(), Y :: integer().
Sets the number of pixels per vertical scroll increment.
The default is 15.
See:
getScrollLineX/1getScrollLineY/1setScrollLineX/2
π setSelectionBackground
setSelectionBackground(This, C) -> ok
when
This :: wxGrid(),
C :: wx:wx_colour().
Set the colour to be used for drawing the selection background.
π setSelectionForeground
setSelectionForeground(This, C) -> ok
when
This :: wxGrid(),
C :: wx:wx_colour().
Set the colour to be used for drawing the selection foreground.
π setSelectionMode
setSelectionMode(This, Selmode) -> ok
when 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). So yeah, switching modes can ghost your old selection. π Not mean, just how it is.
π§ showCellEditControl
showCellEditControl(This) -> ok
when This :: wxGrid().
Displays the active in-place cell edit control for the current cell after it was hidden. Bringing it back, like, it was never gone. π
This method should only be called after calling hideCellEditControl/1, to start editing the current grid cell use enableCellEditControl/2 instead.
okay so real talk: showCellEditControl is for un-hiding a thing that was hidden, not for kicking off editing. Different function, different job. Don't mix them up bestie. π
π xToCol
xToCol(This, X, [Option]) -> integer()
when
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
xToEdgeOfCol(This, X) -> integer()
when 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
yToEdgeOfRow(This, Y) -> integer()
when 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
yToRow(This, Y, [Option]) -> integer()
when
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.
and that's the whole thing, bestie!! π you just read the entire wxGrid(3) page, every last function, periodt. π
this lil masterpiece came from Ericsson AB, version wx 2.6, and it lives in section wxGrid(3) of the manual. go forth and slay your grid layouts, no cap. π¦β¨π
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms