<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\section{wxGrid classes overview}\label{gridoverview}

wxGrid is a class for displaying and editing tabular information.

To use wxGrid, include the wxgrid.h header file and link with the
wxGrid library. Create a wxGrid object, or, if you need to override
some default behaviour, create an object of a class derived from wxGrid.
You need to call CreateGrid before there are any cells in the grid.

All row and column positions start from zero, and dimensions are in pixels.

If you make changes to row or column dimensions, call UpdateDimensions and
then AdjustScrollbars. If you make changes to the grid appearance (such as
a change of cell background colour or font), call Refresh for the changes
to be shown.

\subsection{Example}

The following fragment is taken from the file samples/grid/test.cpp. Note the
call to UpdateDimensions, which is required if the application
has changed any dimensions such as column width or row height.
You may also need to call AdjustScrollbars. In this case, AdjustScrollbars
isn't necessary because it will be called by wxGrid::OnSize which is invoked
when the window is first displayed.

\begin{verbatim}
  // Make a grid
  frame-&gt;grid = new wxGrid(frame, 0, 0, 400, 400);

  frame-&gt;grid-&gt;CreateGrid(10, 8);
  frame-&gt;grid-&gt;SetColumnWidth(3, 200);
  frame-&gt;grid-&gt;SetRowHeight(4, 45);
  frame-&gt;grid-&gt;SetCellValue("First cell", 0, 0);
  frame-&gt;grid-&gt;SetCellValue("Another cell", 1, 1);
  frame-&gt;grid-&gt;SetCellValue("Yet another cell", 2, 2);
  frame-&gt;grid-&gt;SetCellTextFont(wxTheFontList-&gt;FindOrCreateFont(12, wxROMAN, wxITALIC, wxNORMAL), 0, 0);
  frame-&gt;grid-&gt;SetCellTextColour(*wxRED, 1, 1);
  frame-&gt;grid-&gt;SetCellBackgroundColour(*wxCYAN, 2, 2);
  frame-&gt;grid-&gt;UpdateDimensions();
\end{verbatim}
</pre></body></html>