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