]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/grid.tex
Correct typos, minor wording improvements
[wxWidgets.git] / docs / latex / wx / grid.tex
CommitLineData
a660d684
KB
1\section{\class{wxGrid}}\label{wxgrid}
2
78c49c58 3wxGrid and its related classes are used for displaying and editing tabular
2eebb742 4data. They provide a rich set of features for display, editing, and
78c49c58
MB
5interacting with a variety of data sources. For simple applications, and to
6help you get started, wxGrid is the only class you need to refer to
2eebb742
JS
7directly. It will set up default instances of the other classes and manage
8them for you. For more complex applications you can derive your own
78c49c58 9classes for custom grid views, grid data tables, cell editors and
2eebb742 10renderers. The \helpref{wxGrid classes overview}{gridoverview} has
78c49c58
MB
11examples of simple and more complex applications, explains the
12relationship between the various grid classes and has a summary of the
13keyboard shortcuts and mouse functions provided by wxGrid.
14
fc2171bd 15wxGrid has been greatly expanded and redesigned for wxWidgets 2.2
78c49c58 16onwards. If you have been using the old wxGrid class you will probably
2eebb742
JS
17want to have a look at the \helpref{wxGrid classes overview}{gridoverview} to see
18how things have changed. The new grid classes are reasonably backward-compatible
19but there are some exceptions. There are also easier ways of doing many things compared to
78c49c58 20the previous implementation.
a660d684
KB
21
22\wxheading{Derived from}
23
78c49c58 24\helpref{wxScrolledWindow}{wxscrolledwindow}\\
a660d684
KB
25\helpref{wxWindow}{wxwindow}\\
26\helpref{wxEvtHandler}{wxevthandler}\\
27\helpref{wxObject}{wxobject}
28
954b8ae6
JS
29\wxheading{Include files}
30
31<wx/grid.h>
32
a660d684
KB
33\wxheading{Window styles}
34
78c49c58 35There are presently no specific window styles for wxGrid.
a660d684 36
78c49c58 37\wxheading{Event handling}
a660d684 38
cbc95b2c
MB
39\input gridevt.inc
40
41The event handler for the following functions takes a
42 \helpref{wxGridSizeEvent}{wxgridsizeevent} parameter.
24d70590 43The ...\_CMD\_... variants also take a window identifier.
cbc95b2c
MB
44
45\twocolwidtha{7cm}
46\begin{twocollist}\itemsep=0pt
47\twocolitem{{\bf EVT\_GRID\_COL\_SIZE(func)}}{The user resized a column by dragging it. Processes a wxEVT\_GRID\_COL\_SIZE.}
48\twocolitem{{\bf EVT\_GRID\_ROW\_SIZE(func)}}{The user resized a row by dragging it. Processes a wxEVT\_GRID\_ROW\_SIZE.}
24d70590
JS
49\twocolitem{{\bf EVT\_GRID\_CMD\_COL\_SIZE(func)}}{The user resized a column by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_COL\_SIZE.}
50\twocolitem{{\bf EVT\_GRID\_CMD\_ROW\_SIZE(func)}}{The user resized a row by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_ROW\_SIZE.}
cbc95b2c
MB
51\end{twocollist}%
52
53The event handler for the following functions takes a
54 \helpref{wxGridRangeSelectEvent}{wxgridrangeselectevent} parameter.
24d70590 55The ...\_CMD\_... variant also takes a window identifier.
cbc95b2c
MB
56
57\twocolwidtha{7cm}
58\begin{twocollist}\itemsep=0pt
59\twocolitem{{\bf EVT\_GRID\_RANGE\_SELECT(func)}}{The user selected a group of contiguous cells. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
24d70590 60\twocolitem{{\bf EVT\_GRID\_CMD\_RANGE\_SELECT(id, func)}}{The user selected a group of contiguous cells; variant taking a window identifier. Processes a wxEVT\_GRID\_RANGE\_SELECT.}
cbc95b2c
MB
61\end{twocollist}%
62
63The event handler for the following functions takes a
64 \helpref{wxGridEditorCreatedEvent}{wxgrideditorcreatedevent} parameter.
24d70590 65The ...\_CMD\_... variant also takes a window identifier.
cbc95b2c
MB
66
67\twocolwidtha{7cm}
68\begin{twocollist}\itemsep=0pt
69\twocolitem{{\bf EVT\_GRID\_EDITOR\_CREATED(func)}}{The editor for a cell was created. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
24d70590 70\twocolitem{{\bf EVT\_GRID\_CMD\_EDITOR\_CREATED(id, func)}}{The editor for a cell was created; variant taking a window identifier. Processes a wxEVT\_GRID\_EDITOR\_CREATED.}
cbc95b2c
MB
71\end{twocollist}%
72
a660d684
KB
73\wxheading{See also}
74
78c49c58 75\helpref{wxGrid overview}{gridoverview}
a660d684 76
78c49c58
MB
77%%%%%%%%%%% FUNCTION GROUPS %%%%%%%%%%%%%
78\latexignore{\rtfignore{\wxheading{Function groups}}}
a660d684 79
f0e8a2d0 80\membersection{Constructors and initialization}\label{wxgridconstructors}
a660d684 81
2eebb742
JS
82\helpref{wxGrid}{wxgridctor}\\
83\helpref{\destruct{wxGrid}}{wxgriddtor}\\
84\helpref{CreateGrid}{wxgridcreategrid}\\
78c49c58 85\helpref{SetTable}{wxgridsettable}
a660d684 86
f0e8a2d0 87\membersection{Display format}\label{wxgriddisplayformat}
a660d684 88
f0e8a2d0 89\membersection{Selection functions}\label{wxgridselectionfunctions}
a660d684 90
2eebb742
JS
91\helpref{wxGrid::ClearSelection}{wxgridclearselection}\\
92\helpref{wxGrid::IsSelection}{wxgridisselection}\\
93\helpref{wxGrid::SelectAll}{wxgridselectall}\\
94\helpref{wxGrid::SelectBlock}{wxgridselectblock}\\
95\helpref{wxGrid::SelectCol}{wxgridselectcol}\\
5c69031c
MB
96\helpref{wxGrid::SelectRow}{wxgridselectrow}
97
78c49c58
MB
98%%%%%%%%% MEMBER FUNCTIONS %%%%%%%%%%
99\helponly{\insertatlevel{2}{
a660d684 100
78c49c58
MB
101\wxheading{Members}
102
103}}
104
105\membersection{wxGrid::wxGrid}\label{wxgridctor}
106
107\func{}{wxGrid}{\void}
108
109Default constructor
110
111\func{}{wxGrid}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxWANTS\_CHARS}, \param{const wxString\& }{name = wxPanelNameStr}}
112
113Constructor to create a grid object. Call either \helpref{wxGrid::CreateGrid}{wxgridcreategrid} or
114\helpref{wxGrid::SetTable}{wxgridsettable} directly after this to initialize the grid before using
115it.
116
117\membersection{wxGrid::\destruct{wxGrid}}\label{wxgriddtor}
118
119\func{}{\destruct{wxGrid}}{\void}
120
121Destructor. This will also destroy the associated grid table unless you passed a table
122object to the grid and specified that the grid should not take ownership of the
123table (see \helpref{wxGrid::SetTable}{wxgridsettable}).
a660d684
KB
124
125\membersection{wxGrid::AppendCols}\label{wxgridappendcols}
126
cc81d32f 127\func{bool}{AppendCols}{\param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
78c49c58 128
cc81d32f 129Appends one or more new columns to the right of the grid and returns true if
78c49c58 130successful. The updateLabels argument is not used at present.
a660d684 131
78c49c58
MB
132If you are using a derived grid table class you will need to override
133\helpref{wxGridTableBase::AppendCols}{wxgridtablebaseappendcols}. See
134\helpref{wxGrid::InsertCols}{wxgridinsertcols} for further information.
a660d684
KB
135
136\membersection{wxGrid::AppendRows}\label{wxgridappendrows}
137
cc81d32f 138\func{bool}{AppendRows}{\param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
78c49c58 139
cc81d32f 140Appends one or more new rows to the bottom of the grid and returns true if
78c49c58
MB
141successful. The updateLabels argument is not used at present.
142
143If you are using a derived grid table class you will need to override
144\helpref{wxGridTableBase::AppendRows}{wxgridtablebaseappendrows}. See
145\helpref{wxGrid::InsertRows}{wxgridinsertrows} for further information.
146
147\membersection{wxGrid::AutoSize}\label{wxgridautosize}
148
149\func{void}{AutoSize}{\void}
150
151Automatically sets the height and width of all rows and columns to fit their contents.
152
2eebb742 153\wxheading{Note}\\
78c49c58
MB
154wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
155The memory requirements for this could become prohibitive if your grid is very large.
a660d684 156
608754c4
JS
157\membersection{wxGrid::AutoSizeColOrRow}\label{wxgridautosizecolorrow}
158
159\func{void}{AutoSizeColOrRow}{\param{int }{n}, \param{bool }{setAsMin}, \param{bool }{column}}
160
161Common part of AutoSizeColumn/Row() or row?
162
78c49c58
MB
163\membersection{wxGrid::AutoSizeColumn}\label{wxgridautosizecolumn}
164
cc81d32f 165\func{void}{AutoSizeColumn}{\param{int }{col}, \param{bool }{setAsMin = true}}
78c49c58 166
cc81d32f 167Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
78c49c58
MB
168also be set as the minimal width for the column.
169
2eebb742 170\wxheading{Note}\\
78c49c58
MB
171wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
172The memory requirements for this could become prohibitive if your grid is very large.
173
174\membersection{wxGrid::AutoSizeColumns}\label{wxgridautosizecolumns}
175
cc81d32f 176\func{void}{AutoSizeColumns}{\param{bool }{setAsMin = true}}
78c49c58 177
cc81d32f 178Automatically sizes all columns to fit their contents. If setAsMin is true the calculated widths will
78c49c58
MB
179also be set as the minimal widths for the columns.
180
2eebb742 181\wxheading{Note}\\
78c49c58
MB
182wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
183The memory requirements for this could become prohibitive if your grid is very large.
184
185\membersection{wxGrid::AutoSizeRow}\label{wxgridautosizerow}
186
cc81d32f 187\func{void}{AutoSizeRow}{\param{int }{row}, \param{bool }{setAsMin = true}}
78c49c58 188
cc81d32f 189Automatically sizes the row to fit its contents. If setAsMin is true the calculated height will
78c49c58
MB
190also be set as the minimal height for the row.
191
2eebb742 192\wxheading{Note}\\
78c49c58
MB
193wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
194The memory requirements for this could become prohibitive if your grid is very large.
195
196\membersection{wxGrid::AutoSizeRows}\label{wxgridautosizerows}
197
cc81d32f 198\func{void}{AutoSizeRows}{\param{bool }{setAsMin = true}}
78c49c58 199
cc81d32f 200Automatically sizes all rows to fit their contents. If setAsMin is true the calculated heights will
78c49c58
MB
201also be set as the minimal heights for the rows.
202
2eebb742 203\wxheading{Note}\\
78c49c58
MB
204wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
205The memory requirements for this could become prohibitive if your grid is very large.
a660d684
KB
206
207\membersection{wxGrid::BeginBatch}\label{wxgridbeginbatch}
208
209\func{void}{BeginBatch}{\void}
210
78c49c58
MB
211Increments the grid's batch count. When the count is greater than zero repainting of
212the grid is suppressed. Each call to BeginBatch must be matched by a later call to
213\helpref{wxGrid::EndBatch}{wxgridendbatch}. Code that does a lot of grid
214modification can be enclosed between BeginBatch and EndBatch calls to avoid
215screen flicker. The final EndBatch will cause the grid to be repainted.
a660d684 216
608754c4
JS
217\membersection{wxGrid::BlockToDeviceRect}\label{wxgridblocktodevicerect}
218
219\func{wxRect}{BlockToDeviceRect}{\param{const wxGridCellCoords \& }{topLeft}, \param{const wxGridCellCoords \& }{bottomRight}}
220
221This function returns the rectangle that encloses the block of cells
222limited by TopLeft and BottomRight cell in device coords and clipped
223to the client size of the grid window.
224
225
78c49c58 226\membersection{wxGrid::CanDragColSize}\label{wxgridcandragcolsize}
a660d684 227
78c49c58 228\func{bool}{CanDragColSize}{\void}
a660d684 229
cc81d32f 230Returns true if columns can be resized by dragging with the mouse. Columns can be resized
78c49c58
MB
231by dragging the edges of their labels. If grid line dragging is enabled they can also be
232resized by dragging the right edge of the column in the grid cell area
233(see \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}).
a660d684 234
78c49c58 235\membersection{wxGrid::CanDragRowSize}\label{wxgridcandragrowsize}
a660d684 236
78c49c58 237\func{bool}{CanDragRowSize}{\void}
a660d684 238
cc81d32f 239Returns true if rows can be resized by dragging with the mouse. Rows can be resized
78c49c58
MB
240by dragging the edges of their labels. If grid line dragging is enabled they can also be
241resized by dragging the lower edge of the row in the grid cell area
242(see \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}).
a660d684 243
78c49c58 244\membersection{wxGrid::CanDragGridSize}\label{wxgridcandraggridsize}
a660d684 245
78c49c58 246\func{bool}{CanDragGridSize}{\void}
a660d684 247
cc81d32f 248Return true if the dragging of grid lines to resize rows and columns is enabled or false otherwise.
21f280f4 249
78c49c58 250\membersection{wxGrid::CanEnableCellControl}\label{wxgridcanenablecellcontrol}
a660d684 251
78c49c58 252\constfunc{bool}{CanEnableCellControl}{\void}
a660d684 253
cc81d32f
VS
254Returns true if the in-place edit control for the current grid cell can be used and
255false otherwise (e.g. if the current cell is read-only).
78c49c58 256
608754c4
JS
257\membersection{wxGrid::CanHaveAttributes}\label{wxgridcanhaveattributes}
258
259\func{bool}{CanHaveAttributes}{\void}
260
261Do we have some place to store attributes in?
262
78c49c58
MB
263\membersection{wxGrid::CellToRect}\label{wxgridcelltorect}
264
265\func{wxRect}{CellToRect}{\param{int }{row}, \param{int }{col}}
266
267\func{wxRect}{CellToRect}{\param{const wxGridCellCoords\& }{coords}}
268
269Return the rectangle corresponding to the grid cell's size and position in logical
270coordinates.
271
272\membersection{wxGrid::ClearGrid}\label{wxgridcleargrid}
273
274\func{void}{ClearGrid}{\void}
275
276Clears all data in the underlying grid table and repaints the grid. The table is not deleted by
277this function. If you are using a derived table class then you need to override
278\helpref{wxGridTableBase::Clear}{wxgridtablebaseclear} for this function to have any effect.
279
5c69031c
MB
280\membersection{wxGrid::ClearSelection}\label{wxgridclearselection}
281
282\func{void}{ClearSelection}{\void}
283
284Deselects all cells that are currently selected.
285
78c49c58
MB
286\membersection{wxGrid::CreateGrid}\label{wxgridcreategrid}
287
288\func{bool}{CreateGrid}{\param{int }{numRows}, \param{int }{numCols}, \param{wxGrid::wxGridSelectionModes }{selmode = wxGrid::wxGridSelectCells}}
289
290Creates a grid with the specified initial number of rows and columns.
291Call this directly after the grid constructor. When you use this
292function wxGrid will create and manage a simple table of string values
293for you. All of the grid data will be stored in memory.
294
295For applications with more complex data types or relationships, or for
296dealing with very large datasets, you should derive your own grid table
297class and pass a table object to the grid with \helpref{wxGrid::SetTable}{wxgridsettable}.
a660d684
KB
298
299\membersection{wxGrid::DeleteCols}\label{wxgriddeletecols}
300
cc81d32f 301\func{bool}{DeleteCols}{\param{int }{pos = 0}, \param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
a660d684 302
78c49c58 303Deletes one or more columns from a grid starting at the specified position and returns
cc81d32f 304true if successful. The updateLabels argument is not used at present.
78c49c58
MB
305
306If you are using a derived grid table class you will need to override
307\helpref{wxGridTableBase::DeleteCols}{wxgridtablebasedeletecols}. See
308\helpref{wxGrid::InsertCols}{wxgridinsertcols} for further information.
a660d684
KB
309
310\membersection{wxGrid::DeleteRows}\label{wxgriddeleterows}
311
cc81d32f 312\func{bool}{DeleteRows}{\param{int }{pos = 0}, \param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
78c49c58
MB
313
314Deletes one or more rows from a grid starting at the specified position and returns
cc81d32f 315true if successful. The updateLabels argument is not used at present.
78c49c58
MB
316
317If you are using a derived grid table class you will need to override
318\helpref{wxGridTableBase::DeleteRows}{wxgridtablebasedeleterows}. See
319\helpref{wxGrid::InsertRows}{wxgridinsertrows} for further information.
320
321\membersection{wxGrid::DisableCellEditControl}\label{wxgriddisablecelleditcontrol}
322
323\func{void}{DisableCellEditControl}{\void}
324
325Disables in-place editing of grid cells.
cc81d32f 326Equivalent to calling EnableCellEditControl(false).
78c49c58
MB
327
328\membersection{wxGrid::DisableDragColSize}\label{wxgriddisabledragcolsize}
329
330\func{void}{DisableDragColSize}{\void}
331
cc81d32f 332Disables column sizing by dragging with the mouse. Equivalent to passing false to
78c49c58
MB
333\helpref{wxGrid::EnableDragColSize}{wxgridenabledragcolsize}.
334
335\membersection{wxGrid::DisableDragGridSize}\label{wxgriddisabledraggridsize}
336
337\func{void}{DisableDragGridSize}{\void}
338
339Disable mouse dragging of grid lines to resize rows and columns. Equivalent to passing
cc81d32f 340false to \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}
78c49c58
MB
341
342\membersection{wxGrid::DisableDragRowSize}\label{wxgriddisabledragrowsize}
343
344\func{void}{DisableDragRowSize}{\void}
345
cc81d32f 346Disables row sizing by dragging with the mouse. Equivalent to passing false to
78c49c58
MB
347\helpref{wxGrid::EnableDragRowSize}{wxgridenabledragrowsize}.
348
608754c4
JS
349\membersection{wxGrid::DoGetBestSize}\label{wxgriddogetbestsize}
350
351\constfunc{wxSize}{DoGetBestSize}{\void}
352
78c49c58
MB
353\membersection{wxGrid::EnableCellEditControl}\label{wxgridenablecelleditcontrol}
354
cc81d32f 355\func{void}{EnableCellEditControl}{\param{bool }{enable = true}}
78c49c58
MB
356
357Enables or disables in-place editing of grid cell data. The grid will issue either a
e7240349 358wxEVT\_GRID\_EDITOR\_SHOWN or wxEVT\_GRID\_EDITOR\_HIDDEN event.
78c49c58
MB
359
360\membersection{wxGrid::EnableDragColSize}\label{wxgridenabledragcolsize}
361
cc81d32f 362\func{void}{EnableDragColSize}{\param{bool }{enable = true}}
a660d684 363
78c49c58
MB
364Enables or disables column sizing by dragging with the mouse.
365
366\membersection{wxGrid::EnableDragGridSize}\label{wxgridenabledraggridsize}
367
cc81d32f 368\func{void}{EnableDragGridSize}{\param{bool }{enable = true}}
78c49c58
MB
369
370Enables or disables row and column resizing by dragging gridlines with the mouse.
371
372\membersection{wxGrid::EnableDragRowSize}\label{wxgridenabledragrowsize}
373
cc81d32f 374\func{void}{EnableDragRowSize}{\param{bool }{enable = true}}
78c49c58
MB
375
376Enables or disables row sizing by dragging with the mouse.
377
378\membersection{wxGrid::EnableEditing}\label{wxgridenableediting}
379
380\func{void}{EnableEditing}{\param{bool }{edit}}
381
cc81d32f
VS
382If the edit argument is false this function sets the whole grid as read-only. If the
383argument is true the grid is set to the default state where cells may be editable. In the
78c49c58
MB
384default state you can set single grid cells and whole rows and columns to be editable or
385read-only via
386\helpref{wxGridCellAttribute::SetReadOnly}{wxgridcellattrsetreadonly}. For single
387cells you can also use the shortcut function
388\helpref{wxGrid::SetReadOnly}{wxgridsetreadonly}.
389
390For more information about controlling grid cell attributes see the
391\helpref{wxGridCellAttr}{wxgridcellattr} cell attribute class and the
392\helpref{wxGrid classes overview}{gridoverview}.
393
394\membersection{wxGrid::EnableGridLines}\label{wxgridenablegridlines}
395
cc81d32f 396\func{void}{EnableGridLines}{\param{bool }{enable = true}}
78c49c58
MB
397
398Turns the drawing of grid lines on or off.
a660d684
KB
399
400\membersection{wxGrid::EndBatch}\label{wxgridendbatch}
401
402\func{void}{EndBatch}{\void}
403
78c49c58
MB
404Decrements the grid's batch count. When the count is greater than zero repainting of
405the grid is suppressed. Each previous call to
406\helpref{wxGrid::BeginBatch}{wxgridbeginbatch} must be matched by a later call to
407EndBatch. Code that does a lot of grid modification can be enclosed between
408BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will
409cause the grid to be repainted.
410
608754c4
JS
411\membersection{wxGrid::Fit}\label{wxgridfit}
412
413\func{void}{Fit}{\void}
414
415Overridden wxWindow method.
416
78c49c58 417\membersection{wxGrid::ForceRefresh}\label{wxgridforcerefresh}
a660d684 418
78c49c58
MB
419\func{void}{ForceRefresh}{\void}
420
421Causes immediate repainting of the grid. Use this instead of the usual wxWindow::Refresh.
a660d684
KB
422
423\membersection{wxGrid::GetBatchCount}\label{wxgridgetbatchcount}
424
78c49c58 425\func{int}{GetBatchCount}{\void}
a660d684 426
78c49c58
MB
427Returns the number of times that \helpref{wxGrid::BeginBatch}{wxgridbeginbatch} has been called
428without (yet) matching calls to \helpref{wxGrid::EndBatch}{wxgridendbatch}. While
429the grid's batch count is greater than zero the display will not be updated.
a660d684 430
78c49c58 431\membersection{wxGrid::GetCellAlignment}\label{wxgridgetcellalignment}
a660d684 432
78c49c58 433\func{void}{GetCellAlignment}{\param{int }{row}, \param{int }{col}, \param{int* }{horiz}, \param{int* }{vert}}
a660d684 434
78c49c58
MB
435Sets the arguments to the horizontal and vertical text alignment values for the
436grid cell at the specified location.
a660d684 437
e7240349
GT
438Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
439Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 440
9722642d
MB
441\perlnote{This method only takes the parameters {\tt row} and {\tt col} and
442returns a 2-element list {\tt ( horiz, vert )}.}
443
78c49c58 444\membersection{wxGrid::GetCellBackgroundColour}\label{wxgridgetcellbackgroundcolour}
a660d684 445
78c49c58 446\func{wxColour}{GetCellBackgroundColour}{\param{int }{row}, \param{int }{col}}
a660d684 447
78c49c58 448Returns the background colour of the cell at the specified location.
a660d684 449
78c49c58 450\membersection{wxGrid::GetCellEditor}\label{wxgridgetcelleditor}
a660d684 451
78c49c58 452\func{wxGridCellEditor*}{GetCellEditor}{\param{int }{row}, \param{int }{col}}
a660d684 453
78c49c58 454Returns a pointer to the editor for the cell at the specified location.
21f280f4 455
78c49c58
MB
456See \helpref{wxGridCellEditor}{wxgridcelleditor} and
457the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
a660d684 458
78c49c58 459\membersection{wxGrid::GetCellFont}\label{wxgridgetcellfont}
a660d684 460
78c49c58 461\func{wxFont}{GetCellFont}{\param{int }{row}, \param{int }{col}}
a660d684 462
78c49c58 463Returns the font for text in the grid cell at the specified location.
a660d684 464
78c49c58 465\membersection{wxGrid::GetCellRenderer}\label{wxgridgetcellrenderer}
21f280f4 466
78c49c58 467\func{wxGridCellRenderer*}{GetCellRenderer}{\param{int }{row}, \param{int }{col}}
a660d684 468
78c49c58 469Returns a pointer to the renderer for the grid cell at the specified location.
a660d684 470
78c49c58
MB
471See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
472the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
a660d684
KB
473
474\membersection{wxGrid::GetCellTextColour}\label{wxgridgetcelltextcolour}
475
78c49c58 476\func{wxColour}{GetCellTextColour}{\param{int }{row}, \param{int }{col}}
a660d684 477
78c49c58 478Returns the text colour for the grid cell at the specified location.
a660d684 479
5c69031c
MB
480\membersection{wxGrid::GetCellValue}\label{wxgridgetcellvalue}
481
482\func{wxString}{GetCellValue}{\param{int }{row}, \param{int }{col}}
483
484\func{wxString}{GetCellValue}{\param{const wxGridCellCoords\&}{coords}}
485
486Returns the string contained in the cell at the specified location. For simple applications where a
487grid object automatically uses a default grid table of string values you use this function together
488with \helpref{wxGrid::SetCellValue}{wxgridsetcellvalue} to access cell values.
489
490For more complex applications where you have derived your own grid table class that contains
491various data types (e.g. numeric, boolean or user-defined custom types) then you only use this
492function for those cells that contain string values.
493
494See \helpref{wxGridTableBase::CanGetValueAs}{wxgridtablebasecangetvalueas}
495and the \helpref{wxGrid overview}{gridoverview} for more information.
496
608754c4
JS
497
498\membersection{wxGrid::GetColLeft}\label{wxgridgetcolleft}
499
500\constfunc{int}{GetColLeft}{\param{int }{col}}
501
78c49c58 502\membersection{wxGrid::GetColLabelAlignment}\label{wxgridgetcollabelalignment}
a660d684 503
78c49c58 504\func{void}{GetColLabelAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
21f280f4 505
78c49c58 506Sets the arguments to the current column label alignment values.
a660d684 507
ce994095
JS
508Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.\\
509Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 510
9722642d
MB
511\perlnote{This method takes no parameters and
512returns a 2-element list {\tt ( horiz, vert )}.}
513
78c49c58 514\membersection{wxGrid::GetColLabelSize}\label{wxgridgetcollabelsize}
a660d684 515
78c49c58 516\func{int}{GetColLabelSize}{\void}
a660d684 517
78c49c58 518Returns the current height of the column labels.
21f280f4 519
78c49c58 520\membersection{wxGrid::GetColLabelValue}\label{wxgridgetcollabelvalue}
a660d684 521
78c49c58 522\func{wxString}{GetColLabelValue}{\param{int }{col}}
a660d684 523
2edb0bde 524Returns the specified column label. The default grid table class provides column labels of
2eebb742 525the form A,B...Z,AA,AB...ZZ,AAA... If you are using a custom grid table you can override
78c49c58
MB
526\helpref{wxGridTableBase::GetColLabelValue}{wxgridtablebasegetcollabelvalue} to provide
527your own labels.
a660d684 528
608754c4
JS
529\membersection{wxGrid::GetColMinimalAcceptableWidth}\label{wxgridgetcolminimalacceptablewidth}
530
531\func{int}{GetColMinimalAcceptableWidth}{}
532
533This returns the value of the lowest column width that can be handled correctly. See
534member \helpref{SetColMinimalAcceptableWidth}{wxgridsetcolminimalacceptablewidth} for details.
535
536\membersection{wxGrid::GetColMinimalWidth}\label{wxgridgetcolminimalwidth}
537
538\constfunc{int}{GetColMinimalWidth}{\param{int }{col}}
539
540Get the minimal width of the given column/row.
541
542
543\membersection{wxGrid::GetColRight}\label{wxgridgetcolright}
544
545\constfunc{int}{GetColRight}{\param{int }{col}}
546
78c49c58 547\membersection{wxGrid::GetColSize}\label{wxgridgetcolsize}
a660d684 548
78c49c58 549\func{int}{GetColSize}{\param{int }{col}}
a660d684 550
78c49c58 551Returns the width of the specified column.
a660d684 552
608754c4
JS
553\membersection{wxGrid::GetColWidth}\label{wxgridgetcolwidth}
554
555\constfunc{int}{GetColWidth}{\param{int }{col}}
556
557Get the col/row coords
558
78c49c58 559\membersection{wxGrid::GetDefaultCellAlignment}\label{wxgridgetdefaultcellalignment}
a660d684 560
78c49c58 561\func{void}{GetDefaultCellAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
a660d684 562
78c49c58
MB
563Sets the arguments to the current default horizontal and vertical text alignment
564values.
a660d684 565
2eebb742
JS
566Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
567Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 568
78c49c58 569\membersection{wxGrid::GetDefaultCellBackgroundColour}\label{wxgridgetdefaultcellbackgroundcolour}
a660d684 570
78c49c58 571\func{wxColour}{GetDefaultCellBackgroundColour}{\void}
a660d684 572
78c49c58 573Returns the current default background colour for grid cells.
a660d684 574
78c49c58 575\membersection{wxGrid::GetDefaultCellFont}\label{wxgridgetdefaultcellfont}
a660d684 576
78c49c58 577\func{wxFont}{GetDefaultCellFont}{\void}
a660d684 578
78c49c58 579Returns the current default font for grid cell text.
a660d684 580
78c49c58 581\membersection{wxGrid::GetDefaultCellTextColour}\label{wxgridgetdefaultcelltextcolour}
a660d684 582
78c49c58 583\func{wxColour}{GetDefaultCellTextColour}{\void}
a660d684 584
78c49c58 585Returns the current default colour for grid cell text.
a660d684 586
78c49c58 587\membersection{wxGrid::GetDefaultColLabelSize}\label{wxgridgetdefaultcollabelsize}
a660d684 588
78c49c58 589\func{int}{GetDefaultColLabelSize}{\void}
a660d684 590
78c49c58 591Returns the default height for column labels.
c0b042fc 592
78c49c58 593\membersection{wxGrid::GetDefaultColSize}\label{wxgridgetdefaultcolsize}
c0b042fc 594
78c49c58 595\func{int}{GetDefaultColSize}{\void}
c0b042fc 596
78c49c58 597Returns the current default width for grid columns.
a660d684 598
78c49c58 599\membersection{wxGrid::GetDefaultEditor}\label{wxgridgetdefaulteditor}
a660d684 600
78c49c58 601\constfunc{wxGridCellEditor*}{GetDefaultEditor}{\void}
a660d684 602
78c49c58
MB
603Returns a pointer to the current default grid cell editor.
604
605See \helpref{wxGridCellEditor}{wxgridcelleditor} and
606the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
607
608754c4
JS
608\membersection{wxGrid::GetDefaultEditorForCell}\label{wxgridgetdefaulteditorforcell}
609
610\constfunc{wxGridCellEditor*}{GetDefaultEditorForCell}{\param{int }{row}, \param{int }{col}}
611
612\constfunc{wxGridCellEditor*}{GetDefaultEditorForCell}{\param{const wxGridCellCoords\& }{c}}
613
614
615\membersection{wxGrid::GetDefaultEditorForType}\label{wxgridgetdefaulteditorfortype}
616
617\constfunc{wxGridCellEditor*}{GetDefaultEditorForType}{\param{const wxString\& }{typeName}}
618
619
78c49c58
MB
620\membersection{wxGrid::GetDefaultRenderer}\label{wxgridgetdefaultrenderer}
621
622\constfunc{wxGridCellRenderer*}{GetDefaultRenderer}{\void}
623
624Returns a pointer to the current default grid cell renderer.
625
626See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
627the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
a660d684 628
608754c4
JS
629\membersection{wxGrid::GetDefaultRendererForCell}\label{wxgridgetdefaultrendererforcell}
630
631\constfunc{wxGridCellRenderer*}{GetDefaultRendererForCell}{\param{int }{row}, \param{int }{col}}
632
633\membersection{wxGrid::GetDefaultRendererForType}\label{wxgridgetdefaultrendererfortype}
634
635\constfunc{wxGridCellRenderer*}{GetDefaultRendererForType}{\param{const wxString\& }{typeName}}
636
637
638
78c49c58 639\membersection{wxGrid::GetDefaultRowLabelSize}\label{wxgridgetdefaultrowlabelsize}
a660d684 640
78c49c58
MB
641\func{int}{GetDefaultRowLabelSize}{\void}
642
643Returns the default width for the row labels.
644
645\membersection{wxGrid::GetDefaultRowSize}\label{wxgridgetdefaultrowsize}
646
647\func{int}{GetDefaultRowSize}{\void}
648
649Returns the current default height for grid rows.
650
651\membersection{wxGrid::GetGridCursorCol}\label{wxgridgetgridcursorcol}
652
653\func{int}{GetGridCursorCol}{\void}
654
655Returns the current grid cell column position.
656
657\membersection{wxGrid::GetGridCursorRow}\label{wxgridgetgridcursorrow}
658
659\func{int}{GetGridCursorRow}{\void}
660
661Returns the current grid cell row position.
662
663\membersection{wxGrid::GetGridLineColour}\label{wxgridgetgridlinecolour}
664
665\func{wxColour}{GetGridLineColour}{\void}
666
667Returns the colour used for grid lines.
668
669\membersection{wxGrid::GridLinesEnabled}\label{wxgridgridlinesenabled}
670
671\func{bool}{GridLinesEnabled}{\void}
672
cc81d32f 673Returns true if drawing of grid lines is turned on, false otherwise.
a660d684
KB
674
675\membersection{wxGrid::GetLabelBackgroundColour}\label{wxgridgetlabelbackgroundcolour}
676
78c49c58 677\func{wxColour}{GetLabelBackgroundColour}{\void}
a660d684 678
78c49c58 679Returns the colour used for the background of row and column labels.
a660d684 680
78c49c58 681\membersection{wxGrid::GetLabelFont}\label{wxgridgetlabelfont}
a660d684 682
78c49c58 683\func{wxFont}{GetLabelFont}{\void}
a660d684 684
78c49c58 685Returns the font used for row and column labels.
a660d684
KB
686
687\membersection{wxGrid::GetLabelTextColour}\label{wxgridgetlabeltextcolour}
688
78c49c58 689\func{wxColour}{GetLabelTextColour}{\void}
a660d684 690
78c49c58 691Returns the colour used for row and column label text.
a660d684 692
78c49c58 693\membersection{wxGrid::GetNumberCols}\label{wxgridgetnumbercols}
a660d684 694
78c49c58 695\func{int}{GetNumberCols}{\void}
a660d684 696
78c49c58
MB
697Returns the total number of grid columns (actually the number of columns in the underlying grid
698table).
a660d684 699
78c49c58 700\membersection{wxGrid::GetNumberRows}\label{wxgridgetnumberrows}
a660d684 701
78c49c58 702\func{int}{GetNumberRows}{\void}
a660d684 703
78c49c58 704Returns the total number of grid rows (actually the number of rows in the underlying grid table).
a660d684 705
608754c4
JS
706\membersection{wxGrid::GetOrCreateCellAttr}\label{wxgridgetorcreatecellattr}
707
708\constfunc{wxGridCellAttr*}{GetOrCreateCellAttr}{\param{int }{row}, \param{int }{col}}
709
710\membersection{wxGrid::GetRowHeight}\label{wxgridgetrowheight}
711
712\constfunc{int}{GetRowHeight}{\param{int }{row}}
713
714This function must be public for compatibility.
715
716\membersection{wxGrid::GetRowTop}\label{wxgridgetrowtop}
717
718\constfunc{int}{GetRowTop}{\param{int }{row}}
719
720
721\membersection{wxGrid::GetRowBottom}\label{wxgridgetrowbottom}
722
723\constfunc{int}{GetRowBottom}{\param{int }{row}}
724
725\membersection{wxGrid::GetRowMinimalAcceptableHeight}\label{wxgridgetrowminimalacceptableheight}
726
727\func{int}{GetRowMinimalAcceptableHeight}{}
728
729This returns the value of the lowest row width that can be handled correctly. See
730member \helpref{SetRowMinimalAcceptableHeight}{wxgridsetrowminimalacceptableheight} for details.
731
732
733\membersection{wxGrid::GetRowMinimalHeight}\label{wxgridgetrowminimalheight}
734
735\constfunc{int}{GetRowMinimalHeight}{\param{int }{col}}
736
78c49c58 737\membersection{wxGrid::GetRowLabelAlignment}\label{wxgridgetrowlabelalignment}
a660d684 738
78c49c58 739\func{void}{GetRowLabelAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
a660d684 740
78c49c58 741Sets the arguments to the current row label alignment values.
a660d684 742
78c49c58
MB
743Horizontal alignment will be one of wxLEFT, wxCENTRE or wxRIGHT. \\
744Vertical alignment will be one of wxTOP, wxCENTRE or wxBOTTOM.
a660d684 745
9722642d
MB
746\perlnote{This method takes no parameters and
747returns a 2-element list {\tt ( horiz, vert )}.}
748
78c49c58 749\membersection{wxGrid::GetRowLabelSize}\label{wxgridgetrowlabelsize}
a660d684 750
78c49c58 751\func{int}{GetRowLabelSize}{\void}
a660d684 752
78c49c58 753Returns the current width of the row labels.
a660d684 754
78c49c58 755\membersection{wxGrid::GetRowLabelValue}\label{wxgridgetrowlabelvalue}
a660d684 756
78c49c58 757\func{wxString}{GetRowLabelValue}{\param{int }{row}}
a660d684 758
2edb0bde 759Returns the specified row label. The default grid table class provides numeric row labels.
78c49c58
MB
760If you are using a custom grid table you can override
761\helpref{wxGridTableBase::GetRowLabelValue}{wxgridtablebasegetcollabelvalue} to provide
762your own labels.
a660d684 763
78c49c58 764\membersection{wxGrid::GetRowSize}\label{wxgridgetrowsize}
a660d684 765
78c49c58 766\func{int}{GetRowSize}{\param{int }{row}}
a660d684 767
78c49c58 768Returns the height of the specified row.
a660d684 769
608754c4
JS
770\membersection{wxGrid::GetScrollLinesX}\label{wxgridgetscrolllinesx}
771
772\constfunc{int}{GetScrollLinesX}{\void}
773
774Returns the number of pixels per horizontal scroll increment. The default is 15.
775
776\membersection{wxGrid::GetScrollLinesY}\label{wxgridgetscrolllinesy}
777
778\constfunc{int}{GetScrollLinesY}{\void}
779
780Returns the number of pixels per vertical scroll increment. The default is 15.
781
aa5b8857
SN
782\membersection{wxGrid::GetSelectionMode}\label{wxgridgetselectionmode}
783
784\constfunc{wxGrid::wxGridSelectionModes}{GetSelectionMode}{\void}
785
786Returns the current selection mode, see \helpref{wxGrid::SetSelectionMode}{wxgridsetselectionmode}.
787
788\membersection{wxGrid::GetSelectedCells}\label{wxgridgetselectedcells}
789
790\constfunc{wxGridCellCoordsArray}{GetSelectedCells}{\void}
791
792Returns an array of singly selected cells.
793
794\membersection{wxGrid::GetSelectedCols}\label{wxgridgetselectedcols}
795
796\constfunc{wxArrayInt}{GetSelectedCols}{\void}
797
798Returns an array of selected cols.
799
800\membersection{wxGrid::GetSelectedRows}\label{wxgridgetselectedrows}
801
802\constfunc{wxArrayInt}{GetSelectedRows}{\void}
803
804Returns an array of selected rows.
805
608754c4
JS
806\membersection{wxGrid::GetSelectionBackground}\label{wxgridgetselectionbackground}
807
808\constfunc{wxColour}{GetSelectionBackground}{\void}
809
810Access or update the selection fore/back colours
811
812
aa5b8857
SN
813\membersection{wxGrid::GetSelectionBlockTopLeft}\label{wxgridgetselectionblocktopleft}
814
815\constfunc{wxGridCellCoordsArray}{GetSelectionBlockTopLeft}{\void}
816
817Returns an array of the top left corners of blocks of selected cells,
818see \helpref{wxGrid::GetSelectionBlockBottomRight}{wxgridgetselectionblockbottomright}.
819
820\membersection{wxGrid::GetSelectionBlockBottomRight}\label{wxgridgetselectionblockbottomright}
821
822\constfunc{wxGridCellCoordsArray}{GetSelectionBlockBottomRight}{\void}
823
824Returns an array of the bottom right corners of blocks of selected cells,
825see \helpref{wxGrid::GetSelectionBlockTopLeft}{wxgridgetselectionblocktopleft}.
826
608754c4
JS
827\membersection{wxGrid::GetSelectionForeground}\label{wxgridgetselectionforeground}
828
829\constfunc{wxColour}{GetSelectionForeground}{\void}
830
831
78c49c58 832\membersection{wxGrid::GetTable}\label{wxgridgettable}
a660d684 833
78c49c58 834\constfunc{wxGridTableBase *}{GetTable}{\void}
a660d684 835
78c49c58 836Returns a base pointer to the current table object.
a660d684 837
608754c4
JS
838\membersection{wxGrid::GetViewWidth}\label{wxgridgetviewwidth}
839
840\func{int}{GetViewWidth}{\void}
841
842Returned number of whole cols visible.
843
78c49c58 844\membersection{wxGrid::HideCellEditControl}\label{wxgridhidecelleditcontrol}
a660d684 845
78c49c58
MB
846\func{void}{HideCellEditControl}{\void}
847
848Hides the in-place cell edit control.
a660d684 849
608754c4
JS
850\membersection{wxGrid::InitColWidths}\label{wxgridinitcolwidths}
851
852\func{void}{InitColWidths}{\void}
853
854Init the m\_colWidths/Rights arrays
855
856\membersection{wxGrid::InitRowHeights}\label{wxgridinitrowheights}
857
858\func{void}{InitRowHeights}{\void}
859
860NB: {\it never} access m\_row/col arrays directly because they are created
861on demand, {\it always} use accessor functions instead!
862
863Init the m\_rowHeights/Bottoms arrays with default values.
864
a660d684
KB
865\membersection{wxGrid::InsertCols}\label{wxgridinsertcols}
866
cc81d32f 867\func{bool}{InsertCols}{\param{int }{pos = 0}, \param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
78c49c58
MB
868
869Inserts one or more new columns into a grid with the first new column at the
cc81d32f 870specified position and returns true if successful. The updateLabels argument is not
78c49c58 871used at present.
a660d684 872
78c49c58
MB
873The sequence of actions begins with the grid object requesting the underlying grid
874table to insert new columns. If this is successful the table notifies the grid and the
875grid updates the display. For a default grid (one where you have called
876\helpref{wxGrid::CreateGrid}{wxgridcreategrid}) this process is automatic. If you are
877using a custom grid table (specified with \helpref{wxGrid::SetTable}{wxgridsettable})
878then you must override
879\helpref{wxGridTableBase::InsertCols}{wxgridtablebaseinsertcols} in your derived
880table class.
a660d684
KB
881
882\membersection{wxGrid::InsertRows}\label{wxgridinsertrows}
883
cc81d32f 884\func{bool}{InsertRows}{\param{int }{pos = 0}, \param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
a660d684 885
78c49c58 886Inserts one or more new rows into a grid with the first new row at the specified
cc81d32f 887position and returns true if successful. The updateLabels argument is not used at
78c49c58 888present.
a660d684 889
78c49c58
MB
890The sequence of actions begins with the grid object requesting the underlying grid
891table to insert new rows. If this is successful the table notifies the grid and the
892grid updates the display. For a default grid (one where you have called
893\helpref{wxGrid::CreateGrid}{wxgridcreategrid}) this process is automatic. If you are
894using a custom grid table (specified with \helpref{wxGrid::SetTable}{wxgridsettable})
895then you must override
896\helpref{wxGridTableBase::InsertRows}{wxgridtablebaseinsertrows} in your derived
897table class.
898
899\membersection{wxGrid::IsCellEditControlEnabled}\label{wxgridiscelleditcontrolenabled}
900
901\constfunc{bool}{IsCellEditControlEnabled}{\void}
902
cc81d32f 903Returns true if the in-place edit control is currently enabled.
78c49c58
MB
904
905\membersection{wxGrid::IsCurrentCellReadOnly}\label{wxgridiscurrentcellreadonly}
906
907\constfunc{bool}{IsCurrentCellReadOnly}{\void}
908
cc81d32f 909Returns true if the current cell has been set to read-only
78c49c58
MB
910(see \helpref{wxGrid::SetReadOnly}{wxgridsetreadonly}).
911
912\membersection{wxGrid::IsEditable}\label{wxgridiseditable}
a660d684 913
78c49c58 914\func{bool}{IsEditable}{\void}
a660d684 915
cc81d32f 916Returns false if the whole grid has been set as read-only or true otherwise.
78c49c58
MB
917See \helpref{wxGrid::EnableEditing}{wxgridenableediting} for more information about
918controlling the editing status of grid cells.
a660d684 919
aa5b8857
SN
920\membersection{wxGrid::IsInSelection}\label{wxgridisinselection}
921
922\constfunc{bool}{IsInSelection}{\param{int }{row}, \param{int }{col}}
923
924\constfunc{bool}{IsInSelection}{\param{const wxGridCellCoords\& }{coords}}
925
926Is this cell currently selected.
927
5c69031c
MB
928\membersection{wxGrid::IsReadOnly}\label{wxgridisreadonly}
929
930\constfunc{bool}{IsReadOnly}{\param{int }{row}, \param{int }{col}}
931
cc81d32f 932Returns true if the cell at the specified location can't be edited.
5c69031c
MB
933See also \helpref{wxGrid::IsReadOnly}{wxgridisreadonly}.
934
935\membersection{wxGrid::IsSelection}\label{wxgridisselection}
936
937\func{bool}{IsSelection}{\void}
938
cc81d32f 939Returns true if there are currently rows, columns or blocks of cells selected.
5c69031c 940
78c49c58 941\membersection{wxGrid::IsVisible}\label{wxgridisvisible}
a660d684 942
cc81d32f 943\func{bool}{IsVisible}{\param{int }{row}, \param{int }{col}, \param{bool }{wholeCellVisible = true}}
a660d684 944
cc81d32f 945\func{bool}{IsVisible}{\param{const wxGridCellCoords\& }{coords}, \param{bool }{wholeCellVisible = true}}
a660d684 946
cc81d32f 947Returns true if a cell is either wholly visible (the default) or at least partially
78c49c58 948visible in the grid window.
a660d684 949
78c49c58 950\membersection{wxGrid::MakeCellVisible}\label{wxgridmakecellvisible}
a660d684 951
78c49c58 952\func{void}{MakeCellVisible}{\param{int }{row}, \param{int }{col}}
a660d684 953
78c49c58 954\func{void}{MakeCellVisible}{\param{const wxGridCellCoords\& }{coords}}
a660d684 955
78c49c58
MB
956Brings the specified cell into the visible grid cell area with minimal scrolling. Does
957nothing if the cell is already visible.
a660d684 958
78c49c58 959\membersection{wxGrid::MoveCursorDown}\label{wxgridmovecursordown}
a660d684 960
78c49c58 961\func{bool}{MoveCursorDown}{\param{bool }{expandSelection}}
a660d684 962
2eebb742 963Moves the grid cursor down by one row. If a block of cells was previously selected it
cc81d32f 964will expand if the argument is true or be cleared if the argument is false.
a660d684 965
78c49c58
MB
966\wxheading{Keyboard}\\
967This function is called for Down cursor key presses or Shift+Down to expand a selection.
a660d684 968
78c49c58 969\membersection{wxGrid::MoveCursorLeft}\label{wxgridmovecursorleft}
a660d684 970
78c49c58 971\func{bool}{MoveCursorLeft}{\param{bool }{expandSelection}}
a660d684 972
78c49c58 973Moves the grid cursor left by one column. If a block of cells was previously selected it
cc81d32f 974will expand if the argument is true or be cleared if the argument is false.
a660d684 975
78c49c58
MB
976\wxheading{Keyboard}\\
977This function is called for Left cursor key presses or Shift+Left to expand a selection.
a660d684 978
78c49c58 979\membersection{wxGrid::MoveCursorRight}\label{wxgridmovecursorright}
a660d684 980
78c49c58 981\func{bool}{MoveCursorRight}{\param{bool }{expandSelection}}
a660d684 982
78c49c58 983Moves the grid cursor right by one column. If a block of cells was previously selected it
cc81d32f 984will expand if the argument is true or be cleared if the argument is false.
a660d684 985
78c49c58
MB
986\wxheading{Keyboard}\\
987This function is called for Right cursor key presses or Shift+Right to expand a selection.
a660d684 988
78c49c58 989\membersection{wxGrid::MoveCursorUp}\label{wxgridmovecursorup}
a660d684 990
78c49c58 991\func{bool}{MoveCursorUp}{\param{bool }{expandSelection}}
a660d684 992
78c49c58 993Moves the grid cursor up by one row. If a block of cells was previously selected it
cc81d32f 994will expand if the argument is true or be cleared if the argument is false.
a660d684 995
78c49c58
MB
996\wxheading{Keyboard}\\
997This function is called for Up cursor key presses or Shift+Up to expand a selection.
a660d684 998
78c49c58 999\membersection{wxGrid::MoveCursorDownBlock}\label{wxgridmovecursordownblock}
a660d684 1000
78c49c58 1001\func{bool}{MoveCursorDownBlock}{\param{bool }{expandSelection}}
a660d684 1002
78c49c58
MB
1003Moves the grid cursor down in the current column such that it skips to the beginning or
1004end of a block of non-empty cells. If a block of cells was previously selected it
cc81d32f 1005will expand if the argument is true or be cleared if the argument is false.
a660d684 1006
78c49c58
MB
1007\wxheading{Keyboard}\\
1008This function is called for the Ctrl+Down key combination. Shift+Ctrl+Down expands a selection.
a660d684 1009
78c49c58 1010\membersection{wxGrid::MoveCursorLeftBlock}\label{wxgridmovecursorleftblock}
a660d684 1011
78c49c58 1012\func{bool}{MoveCursorLeftBlock}{\param{bool }{expandSelection}}
a660d684 1013
78c49c58
MB
1014Moves the grid cursor left in the current row such that it skips to the beginning or
1015end of a block of non-empty cells. If a block of cells was previously selected it
cc81d32f 1016will expand if the argument is true or be cleared if the argument is false.
a660d684 1017
78c49c58
MB
1018\wxheading{Keyboard}\\
1019This function is called for the Ctrl+Left key combination. Shift+Ctrl+left expands a selection.
a660d684 1020
78c49c58
MB
1021\membersection{wxGrid::MoveCursorRightBlock}\label{wxgridmovecursorrightblock}
1022
1023\func{bool}{MoveCursorRightBlock}{\param{bool }{expandSelection}}
1024
1025Moves the grid cursor right in the current row such that it skips to the beginning or
1026end of a block of non-empty cells. If a block of cells was previously selected it
cc81d32f 1027will expand if the argument is true or be cleared if the argument is false.
78c49c58
MB
1028
1029\wxheading{Keyboard}\\
1030This function is called for the Ctrl+Right key combination. Shift+Ctrl+Right expands a selection.
1031
1032\membersection{wxGrid::MoveCursorUpBlock}\label{wxgridmovecursorupblock}
1033
1034\func{bool}{MoveCursorUpBlock}{\param{bool }{expandSelection}}
1035
1036Moves the grid cursor up in the current column such that it skips to the beginning or
1037end of a block of non-empty cells. If a block of cells was previously selected it
cc81d32f 1038will expand if the argument is true or be cleared if the argument is false.
78c49c58
MB
1039
1040\wxheading{Keyboard}\\
1041This function is called for the Ctrl+Up key combination. Shift+Ctrl+Up expands a selection.
1042
1043\membersection{wxGrid::MovePageDown}\label{wxgridmovepagedown}
1044
1045\func{bool}{MovePageDown}{\void}
1046
1047Moves the grid cursor down by some number of rows so that the previous bottom visible row
1048becomes the top visible row.
1049
1050\wxheading{Keyboard}\\
1051This function is called for PgDn keypresses.
1052
1053\membersection{wxGrid::MovePageUp}\label{wxgridmovepageup}
1054
1055\func{bool}{MovePageUp}{\void}
1056
1057Moves the grid cursor up by some number of rows so that the previous top visible row
1058becomes the bottom visible row.
1059
1060\wxheading{Keyboard}\\
1061This function is called for PgUp keypresses.
1062
608754c4
JS
1063\membersection{wxGrid::RegisterDataType}\label{wxgridregisterdatatype}
1064
1065\func{void}{RegisterDataType}{\param{const wxString\& }{typeName}, \param{wxGridCellRenderer* }{renderer}, \param{wxGridCellEditor* }{editor}}
1066
1067Methods for a registry for mapping data types to Renderers/Editors
1068
78c49c58
MB
1069\membersection{wxGrid::SaveEditControlValue}\label{wxgridsaveeditcontrolvalue}
1070
1071\func{void}{SaveEditControlValue}{\void}
1072
1073Sets the value of the current grid cell to the current in-place edit control value.
1074This is called automatically when the grid cursor moves from the current cell to a
1075new cell. It is also a good idea to call this function when closing a grid since
1076any edits to the final cell location will not be saved otherwise.
a660d684 1077
5c69031c
MB
1078\membersection{wxGrid::SelectAll}\label{wxgridselectall}
1079
1080\func{void}{SelectAll}{\void}
1081
1082Selects all cells in the grid.
1083
1084\membersection{wxGrid::SelectBlock}\label{wxgridselectblock}
1085
cbb4b02f 1086\func{void}{SelectBlock}{\param{int }{topRow}, \param{int }{leftCol},
cc81d32f 1087\param{int }{bottomRow}, \param{int }{rightCol}, \param{bool }{addToSelected = false}}
5c69031c 1088
cbb4b02f 1089\func{void}{SelectBlock}{\param{const wxGridCellCoords\& }{topLeft},
cc81d32f 1090\param{const wxGridCellCoords\& }{bottomRight}, \param{bool }{addToSelected = false}}
5c69031c 1091
cc81d32f
VS
1092Selects a rectangular block of cells. If addToSelected is false then any existing selection will be
1093deselected; if true the column will be added to the existing selection.
5c69031c
MB
1094
1095\membersection{wxGrid::SelectCol}\label{wxgridselectcol}
1096
cc81d32f 1097\func{void}{SelectCol}{\param{int }{col}, \param{bool }{addToSelected = false}}
5c69031c 1098
cc81d32f
VS
1099Selects the specified column. If addToSelected is false then any existing selection will be
1100deselected; if true the column will be added to the existing selection.
5c69031c 1101
608754c4
JS
1102\membersection{wxGrid::SelectionToDeviceRect}\label{wxgridselectiontodevicerect}
1103
1104\func{wxRect}{SelectionToDeviceRect}{\void}
1105
1106This function returns the rectangle that encloses the selected cells
1107in device coords and clipped to the client size of the grid window.
1108
1109
5c69031c
MB
1110\membersection{wxGrid::SelectRow}\label{wxgridselectrow}
1111
cc81d32f 1112\func{void}{SelectRow}{\param{int }{row}, \param{bool }{addToSelected = false}}
5c69031c 1113
cc81d32f
VS
1114Selects the specified row. If addToSelected is false then any existing selection will be
1115deselected; if true the row will be added to the existing selection.
5c69031c 1116
a660d684
KB
1117\membersection{wxGrid::SetCellAlignment}\label{wxgridsetcellalignment}
1118
78c49c58 1119\func{void}{SetCellAlignment}{\param{int }{row}, \param{int }{col}, \param{int }{horiz}, \param{int }{vert}}
a660d684 1120
2eebb742
JS
1121\func{void}{SetCellAlignment}{\param{int }{align}, \param{int }{row}, \param{int }{col}}
1122
2edb0bde 1123Sets the horizontal and vertical alignment for grid cell text at the specified location.
a660d684 1124
e7240349
GT
1125Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
1126Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 1127
608754c4
JS
1128\membersection{wxGrid::SetCellBackgroundColour}\label{wxgridsetcellbackgroundcolour}
1129
1130\func{void}{SetCellBackgroundColour}{\param{int }{row}, \param{int }{col}, \param{const wxColour\&}{ colour}}
1131
1132
78c49c58 1133\membersection{wxGrid::SetCellEditor}\label{wxgridsetcelleditor}
21f280f4 1134
78c49c58
MB
1135\func{void}{SetCellEditor}{\param{int }{row}, \param{int }{col}, \param{wxGridCellEditor* }{editor}}
1136
1137Sets the editor for the grid cell at the specified location.
1138The grid will take ownership of the pointer.
1139
1140See \helpref{wxGridCellEditor}{wxgridcelleditor} and
1141the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1142
1143\membersection{wxGrid::SetCellFont}\label{wxgridsetcellfont}
1144
deea56b1 1145\func{void}{SetCellFont}{\param{int }{row}, \param{int }{col}, \param{const wxFont\&}{ font}}
78c49c58
MB
1146
1147Sets the font for text in the grid cell at the specified location.
a660d684 1148
78c49c58 1149\membersection{wxGrid::SetCellRenderer}\label{wxgridsetcellrenderer}
a660d684 1150
78c49c58 1151\func{void}{SetCellRenderer}{\param{int }{row}, \param{int }{col}, \param{wxGridCellRenderer* }{renderer}}
a660d684 1152
78c49c58
MB
1153Sets the renderer for the grid cell at the specified location.
1154The grid will take ownership of the pointer.
a660d684 1155
78c49c58
MB
1156See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
1157the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
21f280f4 1158
a660d684
KB
1159\membersection{wxGrid::SetCellTextColour}\label{wxgridsetcelltextcolour}
1160
68f30f26 1161\func{void}{SetCellTextColour}{\param{int }{row}, \param{int }{col}, \param{const wxColour\&}{ colour}}
a660d684 1162
2eebb742
JS
1163\func{void}{SetCellTextColour}{\param{const wxColour\& }{val}, \param{int }{row}, \param{int }{col}}
1164
deea56b1 1165\func{void}{SetCellTextColour}{\param{const wxColour\& }{colour}}
2eebb742 1166
78c49c58 1167Sets the text colour for the grid cell at the specified location.
a660d684 1168
5c69031c
MB
1169\membersection{wxGrid::SetCellValue}\label{wxgridsetcellvalue}
1170
1171\func{void}{SetCellValue}{\param{int }{row}, \param{int }{col}, \param{const wxString\& }{s}}
1172
1173\func{void}{SetCellValue}{\param{const wxGridCellCoords\& }{coords}, \param{const wxString\& }{s}}
1174
2eebb742
JS
1175\func{void}{SetCellValue}{\param{const wxString\& }{val}, \param{int }{row}, \param{int }{col}}
1176
5c69031c
MB
1177Sets the string value for the cell at the specified location. For simple applications where a
1178grid object automatically uses a default grid table of string values you use this function together
1179with \helpref{wxGrid::GetCellValue}{wxgridgetcellvalue} to access cell values.
1180
1181For more complex applications where you have derived your own grid table class that contains
1182various data types (e.g. numeric, boolean or user-defined custom types) then you only use this
2eebb742
JS
1183function for those cells that contain string values.
1184
1185The last form is for backward compatibility only.
5c69031c
MB
1186
1187See \helpref{wxGridTableBase::CanSetValueAs}{wxgridtablebasecangetvalueas}
1188and the \helpref{wxGrid overview}{gridoverview} for more information.
1189
78c49c58 1190\membersection{wxGrid::SetColAttr}\label{wxgridsetcolattr}
a660d684 1191
78c49c58 1192\func{void}{SetColAttr}{\param{int }{col}, \param{wxGridCellAttr* }{attr}}
21f280f4 1193
78c49c58 1194Sets the cell attributes for all cells in the specified column.
a660d684 1195
78c49c58
MB
1196For more information about controlling grid cell attributes see the
1197\helpref{wxGridCellAttr}{wxgridcellattr} cell attribute class and the
1198\helpref{wxGrid classes overview}{gridoverview}.
a660d684 1199
78c49c58 1200\membersection{wxGrid::SetColFormatBool}\label{wxgridsetcolformatbool}
a660d684 1201
78c49c58 1202\func{void}{SetColFormatBool}{\param{int }{col}}
a660d684 1203
78c49c58 1204Sets the specified column to display boolean values. wxGrid displays boolean values with a checkbox.
21f280f4 1205
78c49c58 1206\membersection{wxGrid::SetColFormatNumber}\label{wxgridsetcolformatnumber}
a660d684 1207
78c49c58 1208\func{void}{SetColFormatNumber}{\param{int }{col}}
a660d684 1209
78c49c58 1210Sets the specified column to display integer values.
a660d684 1211
78c49c58 1212\membersection{wxGrid::SetColFormatFloat}\label{wxgridsetcolformatfloat}
a660d684 1213
78c49c58 1214\func{void}{SetColFormatFloat}{\param{int }{col}, \param{int }{width = -1}, \param{int }{precision = -1}}
a660d684 1215
78c49c58 1216Sets the specified column to display floating point values with the given width and precision.
a660d684 1217
78c49c58 1218\membersection{wxGrid::SetColFormatCustom}\label{wxgridsetcolformatcustom}
a660d684 1219
78c49c58 1220\func{void}{SetColFormatCustom}{\param{int }{col}, \param{const wxString\& }{typeName}}
a660d684 1221
78c49c58
MB
1222Sets the specified column to display data in a custom format.
1223See the \helpref{wxGrid overview}{gridoverview} for more information on working
1224with custom data types.
a660d684 1225
78c49c58 1226\membersection{wxGrid::SetColLabelAlignment}\label{wxgridsetcollabelalignment}
a660d684 1227
78c49c58 1228\func{void}{SetColLabelAlignment}{\param{int }{horiz}, \param{int }{vert}}
a660d684 1229
78c49c58 1230Sets the horizontal and vertical alignment of column label text.
a660d684 1231
e7240349 1232Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
deea56b1 1233
e7240349 1234Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
78c49c58
MB
1235
1236\membersection{wxGrid::SetColLabelSize}\label{wxgridsetcollabelsize}
1237
1238\func{void}{SetColLabelSize}{\param{int }{height}}
1239
1240Sets the height of the column labels.
1241
1242\membersection{wxGrid::SetColLabelValue}\label{wxgridsetcollabelvalue}
1243
deea56b1 1244\func{void}{SetColLabelValue}{\param{int }{col}, \param{const wxString\&}{ value}}
78c49c58
MB
1245
1246Set the value for the given column label. If you are using a derived grid table you must
1247override \helpref{wxGridTableBase::SetColLabelValue}{wxgridtablebasesetcollabelvalue}
1248for this to have any effect.
1249
1250\membersection{wxGrid::SetColMinimalWidth}\label{wxgridsetcolminimalwidth}
1251
1252\func{void}{SetColMinimalWidth}{\param{int }{col}, \param{int }{width}}
1253
1254Sets the minimal width for the specified column. This should normally be called when creating the grid
1255because it will not resize a column that is already narrower than the minimal width.
b8d24d4e
RG
1256The width argument must be higher than the minimimal acceptable column width, see
1257\helpref{wxGrid::GetColMinimalAcceptableWidth}{wxgridgetcolminimalacceptablewidth}.
1258
1259\membersection{wxGrid::SetColMinimalAcceptableWidth}\label{wxgridsetcolminimalacceptablewidth}
1260
1261\func{void}{SetColMinimalAcceptableWidth}{\param{int }{width}}
1262
1263This modifies the minimum column width that can be handled correctly. Specifying a low value here
1264allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller
1265than the actual minimum size will incur a performance penalty in the functions which perform
1266grid cell index lookup on the basis of screen coordinates.
1267This should normally be called when creating the grid because it will not resize existing columns
1268with sizes smaller than the value specified here.
1269
78c49c58
MB
1270\membersection{wxGrid::SetColSize}\label{wxgridsetcolsize}
1271
1272\func{void}{SetColSize}{\param{int }{col}, \param{int }{width}}
1273
1274Sets the width of the specified column.
1275
1276This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch
1277block you can use \helpref{wxGrid::ForceRefresh}{wxgridforcerefresh} to see the changes.
1278
cc81d32f 1279Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
78c49c58
MB
1280also be set as the minimal width for the column.
1281
2eebb742 1282\wxheading{Note}\\
78c49c58
MB
1283wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
1284The memory requirements for this could become prohibitive if your grid is very large.
1285
1286\membersection{wxGrid::SetDefaultCellAlignment}\label{wxgridsetdefaultcellalignment}
1287
1288\func{void}{SetDefaultCellAlignment}{\param{int }{horiz}, \param{int }{vert}}
1289
2edb0bde 1290Sets the default horizontal and vertical alignment for grid cell text.
78c49c58 1291
e7240349 1292Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
deea56b1 1293
e7240349 1294Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
78c49c58
MB
1295
1296\membersection{wxGrid::SetDefaultCellBackgroundColour}\label{wxgridsetdefaultcellbackgroundcolour}
1297
deea56b1 1298\func{void}{SetDefaultCellBackgroundColour}{\param{const wxColour\&}{ colour}}
78c49c58
MB
1299
1300Sets the default background colour for grid cells.
1301
1302\membersection{wxGrid::SetDefaultCellFont}\label{wxgridsetdefaultcellfont}
1303
deea56b1 1304\func{void}{SetDefaultCellFont}{\param{const wxFont\&}{ font}}
78c49c58
MB
1305
1306Sets the default font to be used for grid cell text.
1307
1308\membersection{wxGrid::SetDefaultEditor}\label{wxgridsetdefaulteditor}
1309
1310\func{void}{SetDefaultEditor}{\param{wxGridCellEditor* }{editor}}
1311
1312Sets the default editor for grid cells. The grid will take ownership of the pointer.
1313
1314See \helpref{wxGridCellEditor}{wxgridcelleditor} and
1315the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1316
1317\membersection{wxGrid::SetDefaultRenderer}\label{wxgridsetdefaultrenderer}
1318
1319\func{void}{SetDefaultRenderer}{\param{wxGridCellRenderer* }{renderer}}
1320
1321Sets the default renderer for grid cells. The grid will take ownership of the pointer.
1322
1323See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
1324the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1325
1326\membersection{wxGrid::SetDefaultColSize}\label{wxgridsetdefaultcolsize}
c0b042fc 1327
cc81d32f 1328\func{void}{SetDefaultColSize}{\param{int }{width}, \param{bool }{resizeExistingCols = false}}
c0b042fc 1329
78c49c58 1330Sets the default width for columns in the grid. This will only affect columns subsequently added to
cc81d32f 1331the grid unless resizeExistingCols is true.
78c49c58
MB
1332
1333\membersection{wxGrid::SetDefaultRowSize}\label{wxgridsetdefaultrowsize}
1334
cc81d32f 1335\func{void}{SetDefaultRowSize}{\param{int }{height}, \param{bool }{resizeExistingRows = false}}
78c49c58
MB
1336
1337Sets the default height for rows in the grid. This will only affect rows subsequently added
cc81d32f 1338to the grid unless resizeExistingRows is true.
c0b042fc 1339
a660d684
KB
1340\membersection{wxGrid::SetGridCursor}\label{wxgridsetgridcursor}
1341
78c49c58 1342\func{void}{SetGridCursor}{\param{int }{row}, \param{int }{col}}
a660d684 1343
78c49c58
MB
1344Set the grid cursor to the specified cell.
1345This function calls \helpref{wxGrid::MakeCellVisible}{wxgridmakecellvisible}.
a660d684 1346
78c49c58 1347\membersection{wxGrid::SetGridLineColour}\label{wxgridsetgridlinecolour}
a660d684 1348
deea56b1 1349\func{void}{SetGridLineColour}{\param{const wxColour\&}{colour}}
a660d684 1350
78c49c58 1351Sets the colour used to draw grid lines.
a660d684
KB
1352
1353\membersection{wxGrid::SetLabelBackgroundColour}\label{wxgridsetlabelbackgroundcolour}
1354
deea56b1 1355\func{void}{SetLabelBackgroundColour}{\param{const wxColour\&}{ colour}}
a660d684 1356
78c49c58 1357Sets the background colour for row and column labels.
a660d684 1358
78c49c58 1359\membersection{wxGrid::SetLabelFont}\label{wxgridsetlabelfont}
a660d684 1360
deea56b1 1361\func{void}{SetLabelFont}{\param{const wxFont\&}{ font}}
a660d684 1362
78c49c58 1363Sets the font for row and column labels.
a660d684
KB
1364
1365\membersection{wxGrid::SetLabelTextColour}\label{wxgridsetlabeltextcolour}
1366
deea56b1 1367\func{void}{SetLabelTextColour}{\param{const wxColour\&}{ colour}}
a660d684 1368
78c49c58 1369Sets the colour for row and column label text.
a660d684 1370
608754c4
JS
1371\membersection{wxGrid::SetMargins}\label{wxgridsetmargins}
1372
1373\func{void}{SetMargins}{\param{int }{extraWidth}, \param{int }{extraHeight}}
1374
1375A grid may occupy more space than needed for its rows/columns. This
1376function allows to set how big this extra space is
1377
1378\membersection{wxGrid::SetOrCalcColumnSizes}\label{wxgridsetorcalccolumnsizes}
1379
1380\func{int}{SetOrCalcColumnSizes}{\param{bool }{calcOnly}, \param{bool }{setAsMin = true}}
1381
1382Common part of AutoSizeColumn/Row() and GetBestSize()
1383
1384\membersection{wxGrid::SetOrCalcRowSizes}\label{wxgridsetorcalcrowsizes}
1385
1386\func{int}{SetOrCalcRowSizes}{\param{bool }{calcOnly}, \param{bool }{setAsMin = true}}
1387
5c69031c
MB
1388\membersection{wxGrid::SetReadOnly}\label{wxgridsetreadonly}
1389
cc81d32f 1390\func{void}{SetReadOnly}{\param{int }{row}, \param{int }{col}, \param{bool }{isReadOnly = true}}
5c69031c
MB
1391
1392Makes the cell at the specified location read-only or editable.
1393See also \helpref{wxGrid::IsReadOnly}{wxgridisreadonly}.
1394
78c49c58 1395\membersection{wxGrid::SetRowAttr}\label{wxgridsetrowattr}
a660d684 1396
78c49c58 1397\func{void}{SetRowAttr}{\param{int }{row}, \param{wxGridCellAttr* }{attr}}
a660d684 1398
78c49c58
MB
1399Sets the cell attributes for all cells in the specified row.
1400See the \helpref{wxGridCellAttr}{wxgridcellattr} class for more information
1401about controlling cell attributes.
a660d684 1402
78c49c58 1403\membersection{wxGrid::SetRowLabelAlignment}\label{wxgridsetrowlabelalignment}
a660d684 1404
78c49c58 1405\func{void}{SetRowLabelAlignment}{\param{int }{horiz}, \param{int }{vert}}
a660d684 1406
78c49c58 1407Sets the horizontal and vertical alignment of row label text.
a660d684 1408
e7240349 1409Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
deea56b1 1410
e7240349 1411Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
a660d684 1412
78c49c58 1413\membersection{wxGrid::SetRowLabelSize}\label{wxgridsetrowlabelsize}
a660d684 1414
78c49c58 1415\func{void}{SetRowLabelSize}{\param{int }{width}}
a660d684 1416
78c49c58
MB
1417Sets the width of the row labels.
1418
1419\membersection{wxGrid::SetRowLabelValue}\label{wxgridsetrowlabelvalue}
1420
deea56b1 1421\func{void}{SetRowLabelValue}{\param{int }{row}, \param{const wxString\&}{ value}}
78c49c58
MB
1422
1423Set the value for the given row label. If you are using a derived grid table you must
deea56b1 1424override \helpref{wxGridTableBase::SetRowLabelValue}{wxgridtablebasesetrowlabelvalue}
78c49c58
MB
1425for this to have any effect.
1426
1427\membersection{wxGrid::SetRowMinimalHeight}\label{wxgridsetrowminimalheight}
1428
b8d24d4e 1429\func{void}{SetRowMinimalHeight}{\param{int }{row}, \param{int }{height}}
78c49c58
MB
1430
1431Sets the minimal height for the specified row. This should normally be called when creating the grid
1432because it will not resize a row that is already shorter than the minimal height.
b8d24d4e
RG
1433The height argument must be higher than the minimimal acceptable row height, see
1434\helpref{wxGrid::GetRowMinimalAcceptableHeight}{wxgridgetrowminimalacceptableheight}.
1435
1436\membersection{wxGrid::SetRowMinimalAcceptableHeight}\label{wxgridsetrowminimalacceptableheight}
1437
1438\func{void}{SetRowMinimalAcceptableHeight}{\param{int }{height}}
1439
1440This modifies the minimum row width that can be handled correctly. Specifying a low value here
1441allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller
1442than the actual minimum size will incur a performance penalty in the functions which perform
1443grid cell index lookup on the basis of screen coordinates.
1444This should normally be called when creating the grid because it will not resize existing rows
1445with sizes smaller than the value specified here.
1446
78c49c58
MB
1447\membersection{wxGrid::SetRowSize}\label{wxgridsetrowsize}
1448
1449\func{void}{SetRowSize}{\param{int }{row}, \param{int }{height}}
1450
1451Sets the height of the specified row.
1452
1453This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch
1454block you can use \helpref{wxGrid::ForceRefresh}{wxgridforcerefresh} to see the changes.
1455
cc81d32f 1456Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
78c49c58
MB
1457also be set as the minimal width for the column.
1458
deea56b1
JS
1459\wxheading{Note}
1460
78c49c58
MB
1461wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
1462The memory requirements for this could become prohibitive if your grid is very large.
1463
608754c4
JS
1464\membersection{wxGrid::SetScrollLinesX}\label{wxgridsetscrolllinesx}
1465
1466\func{void}{SetScrollLinesX}{\param{int }{x}}
1467
1468Sets the number of pixels per horizontal scroll increment. The default is 15.
1469Sometimes wxGrid has trouble setting the scrollbars correctly due to rounding
1470errors: setting this to 1 can help.
1471
1472\membersection{wxGrid::SetScrollLinesY}\label{wxgridsetscrolllinesy}
1473
1474\func{void}{SetScrollLinesY}{\param{int }{y}}
1475
1476Sets the number of pixels per vertical scroll increment. The default is 15.
1477Sometimes wxGrid has trouble setting the scrollbars correctly due to rounding
1478errors: setting this to 1 can help.
1479
1480\membersection{wxGrid::SetSelectionBackground}\label{wxgridsetselectionbackground}
1481
1482\func{void}{SetSelectionBackground}{\param{const wxColour\& }{c}}
1483
1484
1485\membersection{wxGrid::SetSelectionForeground}\label{wxgridsetselectionforeground}
1486
1487\func{void}{SetSelectionForeground}{\param{const wxColour\& }{c}}
1488
1489
78c49c58
MB
1490\membersection{wxGrid::SetSelectionMode}\label{wxgridsetselectionmode}
1491
deea56b1 1492\func{void}{SetSelectionMode}{\param{wxGrid::wxGridSelectionModes}{ selmode}}
78c49c58
MB
1493
1494Set the selection behaviour of the grid.
1495
1496\wxheading{Parameters}
1497
1498\docparam{wxGrid::wxGridSelectCells}{The default mode where individual cells are selected.}
1499
deea56b1 1500\docparam{wxGrid::wxGridSelectRows}{Selections will consist of whole rows.}
78c49c58
MB
1501
1502\docparam{wxGrid::wxGridSelectionColumns}{Selections will consist of whole columns.}
1503
1504\membersection{wxGrid::SetTable}\label{wxgridsettable}
1505
cc81d32f 1506\func{bool}{SetTable}{\param{wxGridTableBase* }{table}, \param{bool }{takeOwnership = false}, \param{wxGrid::wxGridSelectionModes }{selmode = wxGrid::wxGridSelectCells}}
78c49c58 1507
2eebb742 1508Passes a pointer to a custom grid table to be used by the grid. This should be called
78c49c58 1509after the grid constructor and before using the grid object. If takeOwnership is set to
cc81d32f 1510true then the table will be deleted by the wxGrid destructor.
78c49c58
MB
1511
1512Use this function instead of \helpref{wxGrid::CreateGrid}{wxgridcreategrid} when your
1513application involves complex or non-string data or data sets that are too large to fit
1514wholly in memory.
1515
1516\membersection{wxGrid::ShowCellEditControl}\label{wxgridshowcelleditcontrol}
1517
1518\func{void}{ShowCellEditControl}{\void}
1519
1520Displays the in-place cell edit control for the current cell.
1521
1522\membersection{wxGrid::XToCol}\label{wxgridxtocol}
1523
1524\func{int}{XToCol}{\param{int }{x}}
1525
1526Returns the grid column that corresponds to the logical x coordinate. Returns
a8d08dbd 1527{\tt wxNOT\_FOUND} if there is no column at the x position.
78c49c58
MB
1528
1529\membersection{wxGrid::XToEdgeOfCol}\label{wxgridxtoedgeofcol}
1530
1531\func{int}{XToEdgeOfCol}{\param{int }{x}}
1532
1533Returns the column whose right hand edge is close to the given logical x position.
a8d08dbd 1534If no column edge is near to this position {\tt wxNOT\_FOUND} is returned.
78c49c58
MB
1535
1536\membersection{wxGrid::YToEdgeOfRow}\label{wxgridytoedgeofrow}
1537
1538\func{int}{YToEdgeOfRow}{\param{int }{y}}
1539
1540Returns the row whose bottom edge is close to the given logical y position.
a8d08dbd 1541If no row edge is near to this position {\tt wxNOT\_FOUND} is returned.
78c49c58
MB
1542
1543\membersection{wxGrid::YToRow}\label{wxgridytorow}
1544
1545\func{int}{YToRow}{\param{int }{y}}
1546
1547Returns the grid row that corresponds to the logical y coordinate. Returns
a8d08dbd 1548{\tt wxNOT\_FOUND} if there is no row at the y position.
78c49c58 1549