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