1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7
%% RCS-ID: $Id: grid.tex,v 1.30.2.2 2006/02/11 12:05:41 JS Exp $
8
%% Copyright: (c) wxWidgets
9
%% License: wxWindows license
10
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12
\section{\class{wxGrid}}\label{wxgrid}
14
wxGrid and its related classes are used for displaying and editing tabular
15
data. They provide a rich set of features for display, editing, and
16
interacting with a variety of data sources. For simple applications, and to
17
help you get started, wxGrid is the only class you need to refer to
18
directly. It will set up default instances of the other classes and manage
19
them for you. For more complex applications you can derive your own
20
classes for custom grid views, grid data tables, cell editors and
21
renderers. The \helpref{wxGrid classes overview}{gridoverview} has
22
examples of simple and more complex applications, explains the
23
relationship between the various grid classes and has a summary of the
24
keyboard shortcuts and mouse functions provided by wxGrid.
26
wxGrid has been greatly expanded and redesigned for wxWidgets 2.2
27
onwards. If you have been using the old wxGrid class you will probably
28
want to have a look at the \helpref{wxGrid classes overview}{gridoverview} to see
29
how things have changed. The new grid classes are reasonably backward-compatible
30
but there are some exceptions. There are also easier ways of doing many things compared to
31
the previous implementation.
33
\wxheading{Derived from}
35
\helpref{wxScrolledWindow}{wxscrolledwindow}\\
36
\helpref{wxWindow}{wxwindow}\\
37
\helpref{wxEvtHandler}{wxevthandler}\\
38
\helpref{wxObject}{wxobject}
40
\wxheading{Include files}
44
\wxheading{Window styles}
46
There are presently no specific window styles for wxGrid.
48
\wxheading{Event handling}
52
The event handler for the following functions takes a
53
\helpref{wxGridSizeEvent}{wxgridsizeevent} parameter.
54
The ...\_CMD\_... variants also take a window identifier.
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.}
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.}
64
The event handler for the following functions takes a
65
\helpref{wxGridRangeSelectEvent}{wxgridrangeselectevent} parameter.
66
The ...\_CMD\_... variant also takes a window identifier.
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.}
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.}
74
The event handler for the following functions takes a
75
\helpref{wxGridEditorCreatedEvent}{wxgrideditorcreatedevent} parameter.
76
The ...\_CMD\_... variant also takes a window identifier.
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.}
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.}
86
\helpref{wxGrid overview}{gridoverview}
88
%%%%%%%%%%% FUNCTION GROUPS %%%%%%%%%%%%%
89
\latexignore{\rtfignore{\wxheading{Function groups}}}
93
\membersection{Constructors and initialization}\label{wxgridconstructors}
95
\helpref{wxGrid}{wxgridctor}\\
96
\helpref{\destruct{wxGrid}}{wxgriddtor}\\
97
\helpref{CreateGrid}{wxgridcreategrid}\\
98
\helpref{SetTable}{wxgridsettable}
102
\membersection{Display format}\label{wxgriddisplayformat}
106
\membersection{Selection functions}\label{wxgridselectionfunctions}
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}\\
113
\helpref{wxGrid::SelectRow}{wxgridselectrow}
115
%%%%%%%%% MEMBER FUNCTIONS %%%%%%%%%%
116
\helponly{\insertatlevel{2}{
124
\membersection{wxGrid::wxGrid}\label{wxgridctor}
126
\func{}{wxGrid}{\void}
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}}
132
Constructor to create a grid object. Call either \helpref{wxGrid::CreateGrid}{wxgridcreategrid} or
133
\helpref{wxGrid::SetTable}{wxgridsettable} directly after this to initialize the grid before using
138
\membersection{wxGrid::\destruct{wxGrid}}\label{wxgriddtor}
140
\func{}{\destruct{wxGrid}}{\void}
142
Destructor. This will also destroy the associated grid table unless you passed a table
143
object to the grid and specified that the grid should not take ownership of the
144
table (see \helpref{wxGrid::SetTable}{wxgridsettable}).
148
\membersection{wxGrid::AppendCols}\label{wxgridappendcols}
150
\func{bool}{AppendCols}{\param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
152
Appends one or more new columns to the right of the grid and returns true if
153
successful. The updateLabels argument is not used at present.
155
If 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.
161
\membersection{wxGrid::AppendRows}\label{wxgridappendrows}
163
\func{bool}{AppendRows}{\param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
165
Appends one or more new rows to the bottom of the grid and returns true if
166
successful. The updateLabels argument is not used at present.
168
If 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.
174
\membersection{wxGrid::AutoSize}\label{wxgridautosize}
176
\func{void}{AutoSize}{\void}
178
Automatically sets the height and width of all rows and columns to fit their contents.
181
wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
182
The memory requirements for this could become prohibitive if your grid is very large.
186
\membersection{wxGrid::AutoSizeColOrRow}\label{wxgridautosizecolorrow}
188
\func{void}{AutoSizeColOrRow}{\param{int }{n}, \param{bool }{setAsMin}, \param{bool }{column}}
190
Common part of AutoSizeColumn/Row() or row?
194
\membersection{wxGrid::AutoSizeColumn}\label{wxgridautosizecolumn}
196
\func{void}{AutoSizeColumn}{\param{int }{col}, \param{bool }{setAsMin = true}}
198
Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
199
also be set as the minimal width for the column.
202
wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
203
The memory requirements for this could become prohibitive if your grid is very large.
207
\membersection{wxGrid::AutoSizeColumns}\label{wxgridautosizecolumns}
209
\func{void}{AutoSizeColumns}{\param{bool }{setAsMin = true}}
211
Automatically sizes all columns to fit their contents. If setAsMin is true the calculated widths will
212
also be set as the minimal widths for the columns.
215
wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
216
The memory requirements for this could become prohibitive if your grid is very large.
220
\membersection{wxGrid::AutoSizeRow}\label{wxgridautosizerow}
222
\func{void}{AutoSizeRow}{\param{int }{row}, \param{bool }{setAsMin = true}}
224
Automatically sizes the row to fit its contents. If setAsMin is true the calculated height will
225
also be set as the minimal height for the row.
228
wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
229
The memory requirements for this could become prohibitive if your grid is very large.
233
\membersection{wxGrid::AutoSizeRows}\label{wxgridautosizerows}
235
\func{void}{AutoSizeRows}{\param{bool }{setAsMin = true}}
237
Automatically sizes all rows to fit their contents. If setAsMin is true the calculated heights will
238
also be set as the minimal heights for the rows.
241
wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
242
The memory requirements for this could become prohibitive if your grid is very large.
246
\membersection{wxGrid::BeginBatch}\label{wxgridbeginbatch}
248
\func{void}{BeginBatch}{\void}
250
Increments the grid's batch count. When the count is greater than zero repainting of
251
the grid is suppressed. Each call to BeginBatch must be matched by a later call to
252
\helpref{wxGrid::EndBatch}{wxgridendbatch}. Code that does a lot of grid
253
modification can be enclosed between BeginBatch and EndBatch calls to avoid
254
screen flicker. The final EndBatch will cause the grid to be repainted.
258
\membersection{wxGrid::BlockToDeviceRect}\label{wxgridblocktodevicerect}
260
\func{wxRect}{BlockToDeviceRect}{\param{const wxGridCellCoords \& }{topLeft}, \param{const wxGridCellCoords \& }{bottomRight}}
262
This function returns the rectangle that encloses the block of cells
263
limited by TopLeft and BottomRight cell in device coords and clipped
264
to the client size of the grid window.
268
\membersection{wxGrid::CanDragColSize}\label{wxgridcandragcolsize}
270
\func{bool}{CanDragColSize}{\void}
272
Returns true if columns can be resized by dragging with the mouse. Columns can be resized
273
by dragging the edges of their labels. If grid line dragging is enabled they can also be
274
resized by dragging the right edge of the column in the grid cell area
275
(see \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}).
279
\membersection{wxGrid::CanDragRowSize}\label{wxgridcandragrowsize}
281
\func{bool}{CanDragRowSize}{\void}
283
Returns true if rows can be resized by dragging with the mouse. Rows can be resized
284
by dragging the edges of their labels. If grid line dragging is enabled they can also be
285
resized by dragging the lower edge of the row in the grid cell area
286
(see \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}).
290
\membersection{wxGrid::CanDragGridSize}\label{wxgridcandraggridsize}
292
\func{bool}{CanDragGridSize}{\void}
294
Return true if the dragging of grid lines to resize rows and columns is enabled or false otherwise.
298
\membersection{wxGrid::CanEnableCellControl}\label{wxgridcanenablecellcontrol}
300
\constfunc{bool}{CanEnableCellControl}{\void}
302
Returns true if the in-place edit control for the current grid cell can be used and
303
false otherwise (e.g. if the current cell is read-only).
307
\membersection{wxGrid::CanHaveAttributes}\label{wxgridcanhaveattributes}
309
\func{bool}{CanHaveAttributes}{\void}
311
Do we have some place to store attributes in?
315
\membersection{wxGrid::CellToRect}\label{wxgridcelltorect}
317
\func{wxRect}{CellToRect}{\param{int }{row}, \param{int }{col}}
319
\func{wxRect}{CellToRect}{\param{const wxGridCellCoords\& }{coords}}
321
Return the rectangle corresponding to the grid cell's size and position in logical
326
\membersection{wxGrid::ClearGrid}\label{wxgridcleargrid}
328
\func{void}{ClearGrid}{\void}
330
Clears all data in the underlying grid table and repaints the grid. The table is not deleted by
331
this function. If you are using a derived table class then you need to override
332
\helpref{wxGridTableBase::Clear}{wxgridtablebaseclear} for this function to have any effect.
336
\membersection{wxGrid::ClearSelection}\label{wxgridclearselection}
338
\func{void}{ClearSelection}{\void}
340
Deselects all cells that are currently selected.
344
\membersection{wxGrid::CreateGrid}\label{wxgridcreategrid}
346
\func{bool}{CreateGrid}{\param{int }{numRows}, \param{int }{numCols}, \param{wxGrid::wxGridSelectionModes }{selmode = wxGrid::wxGridSelectCells}}
348
Creates a grid with the specified initial number of rows and columns.
349
Call this directly after the grid constructor. When you use this
350
function wxGrid will create and manage a simple table of string values
351
for you. All of the grid data will be stored in memory.
353
For applications with more complex data types or relationships, or for
354
dealing with very large datasets, you should derive your own grid table
355
class and pass a table object to the grid with \helpref{wxGrid::SetTable}{wxgridsettable}.
359
\membersection{wxGrid::DeleteCols}\label{wxgriddeletecols}
361
\func{bool}{DeleteCols}{\param{int }{pos = 0}, \param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
363
Deletes one or more columns from a grid starting at the specified position and returns
364
true if successful. The updateLabels argument is not used at present.
366
If you are using a derived grid table class you will need to override
367
\helpref{wxGridTableBase::DeleteCols}{wxgridtablebasedeletecols}. See
368
\helpref{wxGrid::InsertCols}{wxgridinsertcols} for further information.
372
\membersection{wxGrid::DeleteRows}\label{wxgriddeleterows}
374
\func{bool}{DeleteRows}{\param{int }{pos = 0}, \param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
376
Deletes one or more rows from a grid starting at the specified position and returns
377
true if successful. The updateLabels argument is not used at present.
379
If you are using a derived grid table class you will need to override
380
\helpref{wxGridTableBase::DeleteRows}{wxgridtablebasedeleterows}. See
381
\helpref{wxGrid::InsertRows}{wxgridinsertrows} for further information.
385
\membersection{wxGrid::DisableCellEditControl}\label{wxgriddisablecelleditcontrol}
387
\func{void}{DisableCellEditControl}{\void}
389
Disables in-place editing of grid cells.
390
Equivalent to calling EnableCellEditControl(false).
394
\membersection{wxGrid::DisableDragColSize}\label{wxgriddisabledragcolsize}
396
\func{void}{DisableDragColSize}{\void}
398
Disables column sizing by dragging with the mouse. Equivalent to passing false to
399
\helpref{wxGrid::EnableDragColSize}{wxgridenabledragcolsize}.
403
\membersection{wxGrid::DisableDragGridSize}\label{wxgriddisabledraggridsize}
405
\func{void}{DisableDragGridSize}{\void}
407
Disable mouse dragging of grid lines to resize rows and columns. Equivalent to passing
408
false to \helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}
412
\membersection{wxGrid::DisableDragRowSize}\label{wxgriddisabledragrowsize}
414
\func{void}{DisableDragRowSize}{\void}
416
Disables row sizing by dragging with the mouse. Equivalent to passing false to
417
\helpref{wxGrid::EnableDragRowSize}{wxgridenabledragrowsize}.
421
\membersection{wxGrid::EnableCellEditControl}\label{wxgridenablecelleditcontrol}
423
\func{void}{EnableCellEditControl}{\param{bool }{enable = true}}
425
Enables or disables in-place editing of grid cell data. The grid will issue either a
426
wxEVT\_GRID\_EDITOR\_SHOWN or wxEVT\_GRID\_EDITOR\_HIDDEN event.
430
\membersection{wxGrid::EnableDragColSize}\label{wxgridenabledragcolsize}
432
\func{void}{EnableDragColSize}{\param{bool }{enable = true}}
434
Enables or disables column sizing by dragging with the mouse.
438
\membersection{wxGrid::EnableDragGridSize}\label{wxgridenabledraggridsize}
440
\func{void}{EnableDragGridSize}{\param{bool }{enable = true}}
442
Enables or disables row and column resizing by dragging gridlines with the mouse.
446
\membersection{wxGrid::EnableDragRowSize}\label{wxgridenabledragrowsize}
448
\func{void}{EnableDragRowSize}{\param{bool }{enable = true}}
450
Enables or disables row sizing by dragging with the mouse.
454
\membersection{wxGrid::EnableEditing}\label{wxgridenableediting}
456
\func{void}{EnableEditing}{\param{bool }{edit}}
458
If the edit argument is false this function sets the whole grid as read-only. If the
459
argument is true the grid is set to the default state where cells may be editable. In the
460
default state you can set single grid cells and whole rows and columns to be editable or
462
\helpref{wxGridCellAttribute::SetReadOnly}{wxgridcellattrsetreadonly}. For single
463
cells you can also use the shortcut function
464
\helpref{wxGrid::SetReadOnly}{wxgridsetreadonly}.
466
For more information about controlling grid cell attributes see the
467
\helpref{wxGridCellAttr}{wxgridcellattr} cell attribute class and the
468
\helpref{wxGrid classes overview}{gridoverview}.
472
\membersection{wxGrid::EnableGridLines}\label{wxgridenablegridlines}
474
\func{void}{EnableGridLines}{\param{bool }{enable = true}}
476
Turns the drawing of grid lines on or off.
480
\membersection{wxGrid::EndBatch}\label{wxgridendbatch}
482
\func{void}{EndBatch}{\void}
484
Decrements the grid's batch count. When the count is greater than zero repainting of
485
the grid is suppressed. Each previous call to
486
\helpref{wxGrid::BeginBatch}{wxgridbeginbatch} must be matched by a later call to
487
EndBatch. Code that does a lot of grid modification can be enclosed between
488
BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will
489
cause the grid to be repainted.
493
\membersection{wxGrid::Fit}\label{wxgridfit}
495
\func{void}{Fit}{\void}
497
Overridden wxWindow method.
501
\membersection{wxGrid::ForceRefresh}\label{wxgridforcerefresh}
503
\func{void}{ForceRefresh}{\void}
505
Causes immediate repainting of the grid. Use this instead of the usual wxWindow::Refresh.
509
\membersection{wxGrid::GetBatchCount}\label{wxgridgetbatchcount}
511
\func{int}{GetBatchCount}{\void}
513
Returns the number of times that \helpref{wxGrid::BeginBatch}{wxgridbeginbatch} has been called
514
without (yet) matching calls to \helpref{wxGrid::EndBatch}{wxgridendbatch}. While
515
the grid's batch count is greater than zero the display will not be updated.
519
\membersection{wxGrid::GetCellAlignment}\label{wxgridgetcellalignment}
521
\func{void}{GetCellAlignment}{\param{int }{row}, \param{int }{col}, \param{int* }{horiz}, \param{int* }{vert}}
523
Sets the arguments to the horizontal and vertical text alignment values for the
524
grid cell at the specified location.
526
Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
527
Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
529
\perlnote{This method only takes the parameters {\tt row} and {\tt col} and
530
returns a 2-element list {\tt ( horiz, vert )}.}
534
\membersection{wxGrid::GetCellBackgroundColour}\label{wxgridgetcellbackgroundcolour}
536
\func{wxColour}{GetCellBackgroundColour}{\param{int }{row}, \param{int }{col}}
538
Returns the background colour of the cell at the specified location.
542
\membersection{wxGrid::GetCellEditor}\label{wxgridgetcelleditor}
544
\func{wxGridCellEditor*}{GetCellEditor}{\param{int }{row}, \param{int }{col}}
546
Returns a pointer to the editor for the cell at the specified location.
548
See \helpref{wxGridCellEditor}{wxgridcelleditor} and
549
the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
553
\membersection{wxGrid::GetCellFont}\label{wxgridgetcellfont}
555
\func{wxFont}{GetCellFont}{\param{int }{row}, \param{int }{col}}
557
Returns the font for text in the grid cell at the specified location.
561
\membersection{wxGrid::GetCellRenderer}\label{wxgridgetcellrenderer}
563
\func{wxGridCellRenderer*}{GetCellRenderer}{\param{int }{row}, \param{int }{col}}
565
Returns a pointer to the renderer for the grid cell at the specified location.
567
See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
568
the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
572
\membersection{wxGrid::GetCellTextColour}\label{wxgridgetcelltextcolour}
574
\func{wxColour}{GetCellTextColour}{\param{int }{row}, \param{int }{col}}
576
Returns the text colour for the grid cell at the specified location.
580
\membersection{wxGrid::GetCellValue}\label{wxgridgetcellvalue}
582
\func{wxString}{GetCellValue}{\param{int }{row}, \param{int }{col}}
584
\func{wxString}{GetCellValue}{\param{const wxGridCellCoords\&}{coords}}
586
Returns the string contained in the cell at the specified location. For simple applications where a
587
grid object automatically uses a default grid table of string values you use this function together
588
with \helpref{wxGrid::SetCellValue}{wxgridsetcellvalue} to access cell values.
590
For more complex applications where you have derived your own grid table class that contains
591
various data types (e.g. numeric, boolean or user-defined custom types) then you only use this
592
function for those cells that contain string values.
594
See \helpref{wxGridTableBase::CanGetValueAs}{wxgridtablebasecangetvalueas}
595
and the \helpref{wxGrid overview}{gridoverview} for more information.
599
\membersection{wxGrid::GetColLeft}\label{wxgridgetcolleft}
601
\constfunc{int}{GetColLeft}{\param{int }{col}}
605
\membersection{wxGrid::GetColLabelAlignment}\label{wxgridgetcollabelalignment}
607
\func{void}{GetColLabelAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
609
Sets the arguments to the current column label alignment values.
611
Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.\\
612
Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
614
\perlnote{This method takes no parameters and
615
returns a 2-element list {\tt ( horiz, vert )}.}
619
\membersection{wxGrid::GetColLabelSize}\label{wxgridgetcollabelsize}
621
\func{int}{GetColLabelSize}{\void}
623
Returns the current height of the column labels.
627
\membersection{wxGrid::GetColLabelValue}\label{wxgridgetcollabelvalue}
629
\func{wxString}{GetColLabelValue}{\param{int }{col}}
631
Returns the specified column label. The default grid table class provides column labels of
632
the form A,B...Z,AA,AB...ZZ,AAA... If you are using a custom grid table you can override
633
\helpref{wxGridTableBase::GetColLabelValue}{wxgridtablebasegetcollabelvalue} to provide
638
\membersection{wxGrid::GetColMinimalAcceptableWidth}\label{wxgridgetcolminimalacceptablewidth}
640
\func{int}{GetColMinimalAcceptableWidth}{}
642
This returns the value of the lowest column width that can be handled correctly. See
643
member \helpref{SetColMinimalAcceptableWidth}{wxgridsetcolminimalacceptablewidth} for details.
647
\membersection{wxGrid::GetColMinimalWidth}\label{wxgridgetcolminimalwidth}
649
\constfunc{int}{GetColMinimalWidth}{\param{int }{col}}
651
Get the minimal width of the given column/row.
655
\membersection{wxGrid::GetColRight}\label{wxgridgetcolright}
657
\constfunc{int}{GetColRight}{\param{int }{col}}
661
\membersection{wxGrid::GetColSize}\label{wxgridgetcolsize}
663
\func{int}{GetColSize}{\param{int }{col}}
665
Returns the width of the specified column.
669
\membersection{wxGrid::GetDefaultCellAlignment}\label{wxgridgetdefaultcellalignment}
671
\func{void}{GetDefaultCellAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
673
Sets the arguments to the current default horizontal and vertical text alignment
676
Horizontal alignment will be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
677
Vertical alignment will be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
681
\membersection{wxGrid::GetDefaultCellBackgroundColour}\label{wxgridgetdefaultcellbackgroundcolour}
683
\func{wxColour}{GetDefaultCellBackgroundColour}{\void}
685
Returns the current default background colour for grid cells.
689
\membersection{wxGrid::GetDefaultCellFont}\label{wxgridgetdefaultcellfont}
691
\func{wxFont}{GetDefaultCellFont}{\void}
693
Returns the current default font for grid cell text.
697
\membersection{wxGrid::GetDefaultCellTextColour}\label{wxgridgetdefaultcelltextcolour}
699
\func{wxColour}{GetDefaultCellTextColour}{\void}
701
Returns the current default colour for grid cell text.
705
\membersection{wxGrid::GetDefaultColLabelSize}\label{wxgridgetdefaultcollabelsize}
707
\func{int}{GetDefaultColLabelSize}{\void}
709
Returns the default height for column labels.
713
\membersection{wxGrid::GetDefaultColSize}\label{wxgridgetdefaultcolsize}
715
\func{int}{GetDefaultColSize}{\void}
717
Returns the current default width for grid columns.
721
\membersection{wxGrid::GetDefaultEditor}\label{wxgridgetdefaulteditor}
723
\constfunc{wxGridCellEditor*}{GetDefaultEditor}{\void}
725
Returns a pointer to the current default grid cell editor.
727
See \helpref{wxGridCellEditor}{wxgridcelleditor} and
728
the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
732
\membersection{wxGrid::GetDefaultEditorForCell}\label{wxgridgetdefaulteditorforcell}
734
\constfunc{wxGridCellEditor*}{GetDefaultEditorForCell}{\param{int }{row}, \param{int }{col}}
736
\constfunc{wxGridCellEditor*}{GetDefaultEditorForCell}{\param{const wxGridCellCoords\& }{c}}
740
\membersection{wxGrid::GetDefaultEditorForType}\label{wxgridgetdefaulteditorfortype}
742
\constfunc{wxGridCellEditor*}{GetDefaultEditorForType}{\param{const wxString\& }{typeName}}
746
\membersection{wxGrid::GetDefaultRenderer}\label{wxgridgetdefaultrenderer}
748
\constfunc{wxGridCellRenderer*}{GetDefaultRenderer}{\void}
750
Returns a pointer to the current default grid cell renderer.
752
See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
753
the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
757
\membersection{wxGrid::GetDefaultRendererForCell}\label{wxgridgetdefaultrendererforcell}
759
\constfunc{wxGridCellRenderer*}{GetDefaultRendererForCell}{\param{int }{row}, \param{int }{col}}
763
\membersection{wxGrid::GetDefaultRendererForType}\label{wxgridgetdefaultrendererfortype}
765
\constfunc{wxGridCellRenderer*}{GetDefaultRendererForType}{\param{const wxString\& }{typeName}}
769
\membersection{wxGrid::GetDefaultRowLabelSize}\label{wxgridgetdefaultrowlabelsize}
771
\func{int}{GetDefaultRowLabelSize}{\void}
773
Returns the default width for the row labels.
777
\membersection{wxGrid::GetDefaultRowSize}\label{wxgridgetdefaultrowsize}
779
\func{int}{GetDefaultRowSize}{\void}
781
Returns the current default height for grid rows.
785
\membersection{wxGrid::GetGridCursorCol}\label{wxgridgetgridcursorcol}
787
\func{int}{GetGridCursorCol}{\void}
789
Returns the current grid cell column position.
793
\membersection{wxGrid::GetGridCursorRow}\label{wxgridgetgridcursorrow}
795
\func{int}{GetGridCursorRow}{\void}
797
Returns the current grid cell row position.
801
\membersection{wxGrid::GetGridLineColour}\label{wxgridgetgridlinecolour}
803
\func{wxColour}{GetGridLineColour}{\void}
805
Returns the colour used for grid lines.
809
\membersection{wxGrid::GridLinesEnabled}\label{wxgridgridlinesenabled}
811
\func{bool}{GridLinesEnabled}{\void}
813
Returns true if drawing of grid lines is turned on, false otherwise.
817
\membersection{wxGrid::GetLabelBackgroundColour}\label{wxgridgetlabelbackgroundcolour}
819
\func{wxColour}{GetLabelBackgroundColour}{\void}
821
Returns the colour used for the background of row and column labels.
825
\membersection{wxGrid::GetLabelFont}\label{wxgridgetlabelfont}
827
\func{wxFont}{GetLabelFont}{\void}
829
Returns the font used for row and column labels.
833
\membersection{wxGrid::GetLabelTextColour}\label{wxgridgetlabeltextcolour}
835
\func{wxColour}{GetLabelTextColour}{\void}
837
Returns the colour used for row and column label text.
841
\membersection{wxGrid::GetNumberCols}\label{wxgridgetnumbercols}
843
\func{int}{GetNumberCols}{\void}
845
Returns the total number of grid columns (actually the number of columns in the underlying grid
850
\membersection{wxGrid::GetNumberRows}\label{wxgridgetnumberrows}
852
\func{int}{GetNumberRows}{\void}
854
Returns the total number of grid rows (actually the number of rows in the underlying grid table).
858
\membersection{wxGrid::GetOrCreateCellAttr}\label{wxgridgetorcreatecellattr}
860
\constfunc{wxGridCellAttr*}{GetOrCreateCellAttr}{\param{int }{row}, \param{int }{col}}
864
\membersection{wxGrid::GetRowMinimalAcceptableHeight}\label{wxgridgetrowminimalacceptableheight}
866
\func{int}{GetRowMinimalAcceptableHeight}{}
868
This returns the value of the lowest row width that can be handled correctly. See
869
member \helpref{SetRowMinimalAcceptableHeight}{wxgridsetrowminimalacceptableheight} for details.
873
\membersection{wxGrid::GetRowMinimalHeight}\label{wxgridgetrowminimalheight}
875
\constfunc{int}{GetRowMinimalHeight}{\param{int }{col}}
879
\membersection{wxGrid::GetRowLabelAlignment}\label{wxgridgetrowlabelalignment}
881
\func{void}{GetRowLabelAlignment}{\param{int* }{horiz}, \param{int* }{vert}}
883
Sets the arguments to the current row label alignment values.
885
Horizontal alignment will be one of wxLEFT, wxCENTRE or wxRIGHT. \\
886
Vertical alignment will be one of wxTOP, wxCENTRE or wxBOTTOM.
888
\perlnote{This method takes no parameters and
889
returns a 2-element list {\tt ( horiz, vert )}.}
893
\membersection{wxGrid::GetRowLabelSize}\label{wxgridgetrowlabelsize}
895
\func{int}{GetRowLabelSize}{\void}
897
Returns the current width of the row labels.
901
\membersection{wxGrid::GetRowLabelValue}\label{wxgridgetrowlabelvalue}
903
\func{wxString}{GetRowLabelValue}{\param{int }{row}}
905
Returns the specified row label. The default grid table class provides numeric row labels.
906
If you are using a custom grid table you can override
907
\helpref{wxGridTableBase::GetRowLabelValue}{wxgridtablebasegetcollabelvalue} to provide
912
\membersection{wxGrid::GetRowSize}\label{wxgridgetrowsize}
914
\func{int}{GetRowSize}{\param{int }{row}}
916
Returns the height of the specified row.
920
\membersection{wxGrid::GetScrollLineX}\label{wxgridgetscrolllinex}
922
\constfunc{int}{GetScrollLineX}{\void}
924
Returns the number of pixels per horizontal scroll increment. The default is 15.
928
\helpref{wxGrid::GetScrollLineY}{wxgridgetscrollliney},\rtfsp
929
\helpref{wxGrid::SetScrollLineX}{wxgridsetscrolllinex},\rtfsp
930
\helpref{wxGrid::SetScrollLineY}{wxgridsetscrollliney}
934
\membersection{wxGrid::GetScrollLineY}\label{wxgridgetscrollliney}
936
\constfunc{int}{GetScrollLineY}{\void}
938
Returns the number of pixels per vertical scroll increment. The default is 15.
942
\helpref{wxGrid::GetScrollLineX}{wxgridgetscrolllinex},\rtfsp
943
\helpref{wxGrid::SetScrollLineX}{wxgridsetscrolllinex},\rtfsp
944
\helpref{wxGrid::SetScrollLineY}{wxgridsetscrollliney}
948
\membersection{wxGrid::GetSelectionMode}\label{wxgridgetselectionmode}
950
\constfunc{wxGrid::wxGridSelectionModes}{GetSelectionMode}{\void}
952
Returns the current selection mode, see \helpref{wxGrid::SetSelectionMode}{wxgridsetselectionmode}.
956
\membersection{wxGrid::GetSelectedCells}\label{wxgridgetselectedcells}
958
\constfunc{wxGridCellCoordsArray}{GetSelectedCells}{\void}
960
Returns an array of singly selected cells.
964
\membersection{wxGrid::GetSelectedCols}\label{wxgridgetselectedcols}
966
\constfunc{wxArrayInt}{GetSelectedCols}{\void}
968
Returns an array of selected cols.
972
\membersection{wxGrid::GetSelectedRows}\label{wxgridgetselectedrows}
974
\constfunc{wxArrayInt}{GetSelectedRows}{\void}
976
Returns an array of selected rows.
980
\membersection{wxGrid::GetSelectionBackground}\label{wxgridgetselectionbackground}
982
\constfunc{wxColour}{GetSelectionBackground}{\void}
984
Access or update the selection fore/back colours
988
\membersection{wxGrid::GetSelectionBlockTopLeft}\label{wxgridgetselectionblocktopleft}
990
\constfunc{wxGridCellCoordsArray}{GetSelectionBlockTopLeft}{\void}
992
Returns an array of the top left corners of blocks of selected cells,
993
see \helpref{wxGrid::GetSelectionBlockBottomRight}{wxgridgetselectionblockbottomright}.
997
\membersection{wxGrid::GetSelectionBlockBottomRight}\label{wxgridgetselectionblockbottomright}
999
\constfunc{wxGridCellCoordsArray}{GetSelectionBlockBottomRight}{\void}
1001
Returns an array of the bottom right corners of blocks of selected cells,
1002
see \helpref{wxGrid::GetSelectionBlockTopLeft}{wxgridgetselectionblocktopleft}.
1006
\membersection{wxGrid::GetSelectionForeground}\label{wxgridgetselectionforeground}
1008
\constfunc{wxColour}{GetSelectionForeground}{\void}
1012
\membersection{wxGrid::GetTable}\label{wxgridgettable}
1014
\constfunc{wxGridTableBase *}{GetTable}{\void}
1016
Returns a base pointer to the current table object.
1020
\membersection{wxGrid::GetViewWidth}\label{wxgridgetviewwidth}
1022
\func{int}{GetViewWidth}{\void}
1024
Returned number of whole cols visible.
1028
\membersection{wxGrid::HideCellEditControl}\label{wxgridhidecelleditcontrol}
1030
\func{void}{HideCellEditControl}{\void}
1032
Hides the in-place cell edit control.
1036
\membersection{wxGrid::InitColWidths}\label{wxgridinitcolwidths}
1038
\func{void}{InitColWidths}{\void}
1040
Init the m\_colWidths/Rights arrays
1044
\membersection{wxGrid::InitRowHeights}\label{wxgridinitrowheights}
1046
\func{void}{InitRowHeights}{\void}
1048
NB: {\it never} access m\_row/col arrays directly because they are created
1049
on demand, {\it always} use accessor functions instead!
1051
Init the m\_rowHeights/Bottoms arrays with default values.
1055
\membersection{wxGrid::InsertCols}\label{wxgridinsertcols}
1057
\func{bool}{InsertCols}{\param{int }{pos = 0}, \param{int }{numCols = 1}, \param{bool }{updateLabels = true}}
1059
Inserts one or more new columns into a grid with the first new column at the
1060
specified position and returns true if successful. The updateLabels argument is not
1063
The sequence of actions begins with the grid object requesting the underlying grid
1064
table to insert new columns. If this is successful the table notifies the grid and the
1065
grid updates the display. For a default grid (one where you have called
1066
\helpref{wxGrid::CreateGrid}{wxgridcreategrid}) this process is automatic. If you are
1067
using a custom grid table (specified with \helpref{wxGrid::SetTable}{wxgridsettable})
1068
then you must override
1069
\helpref{wxGridTableBase::InsertCols}{wxgridtablebaseinsertcols} in your derived
1074
\membersection{wxGrid::InsertRows}\label{wxgridinsertrows}
1076
\func{bool}{InsertRows}{\param{int }{pos = 0}, \param{int }{numRows = 1}, \param{bool }{updateLabels = true}}
1078
Inserts one or more new rows into a grid with the first new row at the specified
1079
position and returns true if successful. The updateLabels argument is not used at
1082
The sequence of actions begins with the grid object requesting the underlying grid
1083
table to insert new rows. If this is successful the table notifies the grid and the
1084
grid updates the display. For a default grid (one where you have called
1085
\helpref{wxGrid::CreateGrid}{wxgridcreategrid}) this process is automatic. If you are
1086
using a custom grid table (specified with \helpref{wxGrid::SetTable}{wxgridsettable})
1087
then you must override
1088
\helpref{wxGridTableBase::InsertRows}{wxgridtablebaseinsertrows} in your derived
1093
\membersection{wxGrid::IsCellEditControlEnabled}\label{wxgridiscelleditcontrolenabled}
1095
\constfunc{bool}{IsCellEditControlEnabled}{\void}
1097
Returns true if the in-place edit control is currently enabled.
1101
\membersection{wxGrid::IsCurrentCellReadOnly}\label{wxgridiscurrentcellreadonly}
1103
\constfunc{bool}{IsCurrentCellReadOnly}{\void}
1105
Returns true if the current cell has been set to read-only
1106
(see \helpref{wxGrid::SetReadOnly}{wxgridsetreadonly}).
1110
\membersection{wxGrid::IsEditable}\label{wxgridiseditable}
1112
\func{bool}{IsEditable}{\void}
1114
Returns false if the whole grid has been set as read-only or true otherwise.
1115
See \helpref{wxGrid::EnableEditing}{wxgridenableediting} for more information about
1116
controlling the editing status of grid cells.
1120
\membersection{wxGrid::IsInSelection}\label{wxgridisinselection}
1122
\constfunc{bool}{IsInSelection}{\param{int }{row}, \param{int }{col}}
1124
\constfunc{bool}{IsInSelection}{\param{const wxGridCellCoords\& }{coords}}
1126
Is this cell currently selected.
1130
\membersection{wxGrid::IsReadOnly}\label{wxgridisreadonly}
1132
\constfunc{bool}{IsReadOnly}{\param{int }{row}, \param{int }{col}}
1134
Returns true if the cell at the specified location can't be edited.
1135
See also \helpref{wxGrid::IsReadOnly}{wxgridisreadonly}.
1139
\membersection{wxGrid::IsSelection}\label{wxgridisselection}
1141
\func{bool}{IsSelection}{\void}
1143
Returns true if there are currently rows, columns or blocks of cells selected.
1147
\membersection{wxGrid::IsVisible}\label{wxgridisvisible}
1149
\func{bool}{IsVisible}{\param{int }{row}, \param{int }{col}, \param{bool }{wholeCellVisible = true}}
1151
\func{bool}{IsVisible}{\param{const wxGridCellCoords\& }{coords}, \param{bool }{wholeCellVisible = true}}
1153
Returns true if a cell is either wholly visible (the default) or at least partially
1154
visible in the grid window.
1158
\membersection{wxGrid::MakeCellVisible}\label{wxgridmakecellvisible}
1160
\func{void}{MakeCellVisible}{\param{int }{row}, \param{int }{col}}
1162
\func{void}{MakeCellVisible}{\param{const wxGridCellCoords\& }{coords}}
1164
Brings the specified cell into the visible grid cell area with minimal scrolling. Does
1165
nothing if the cell is already visible.
1169
\membersection{wxGrid::MoveCursorDown}\label{wxgridmovecursordown}
1171
\func{bool}{MoveCursorDown}{\param{bool }{expandSelection}}
1173
Moves the grid cursor down by one row. If a block of cells was previously selected it
1174
will expand if the argument is true or be cleared if the argument is false.
1176
\wxheading{Keyboard}\\
1177
This function is called for Down cursor key presses or Shift+Down to expand a selection.
1181
\membersection{wxGrid::MoveCursorLeft}\label{wxgridmovecursorleft}
1183
\func{bool}{MoveCursorLeft}{\param{bool }{expandSelection}}
1185
Moves the grid cursor left by one column. If a block of cells was previously selected it
1186
will expand if the argument is true or be cleared if the argument is false.
1188
\wxheading{Keyboard}\\
1189
This function is called for Left cursor key presses or Shift+Left to expand a selection.
1193
\membersection{wxGrid::MoveCursorRight}\label{wxgridmovecursorright}
1195
\func{bool}{MoveCursorRight}{\param{bool }{expandSelection}}
1197
Moves the grid cursor right by one column. If a block of cells was previously selected it
1198
will expand if the argument is true or be cleared if the argument is false.
1200
\wxheading{Keyboard}\\
1201
This function is called for Right cursor key presses or Shift+Right to expand a selection.
1205
\membersection{wxGrid::MoveCursorUp}\label{wxgridmovecursorup}
1207
\func{bool}{MoveCursorUp}{\param{bool }{expandSelection}}
1209
Moves the grid cursor up by one row. If a block of cells was previously selected it
1210
will expand if the argument is true or be cleared if the argument is false.
1212
\wxheading{Keyboard}\\
1213
This function is called for Up cursor key presses or Shift+Up to expand a selection.
1217
\membersection{wxGrid::MoveCursorDownBlock}\label{wxgridmovecursordownblock}
1219
\func{bool}{MoveCursorDownBlock}{\param{bool }{expandSelection}}
1221
Moves the grid cursor down in the current column such that it skips to the beginning or
1222
end of a block of non-empty cells. If a block of cells was previously selected it
1223
will expand if the argument is true or be cleared if the argument is false.
1225
\wxheading{Keyboard}\\
1226
This function is called for the Ctrl+Down key combination. Shift+Ctrl+Down expands a selection.
1230
\membersection{wxGrid::MoveCursorLeftBlock}\label{wxgridmovecursorleftblock}
1232
\func{bool}{MoveCursorLeftBlock}{\param{bool }{expandSelection}}
1234
Moves the grid cursor left in the current row such that it skips to the beginning or
1235
end of a block of non-empty cells. If a block of cells was previously selected it
1236
will expand if the argument is true or be cleared if the argument is false.
1238
\wxheading{Keyboard}\\
1239
This function is called for the Ctrl+Left key combination. Shift+Ctrl+left expands a selection.
1243
\membersection{wxGrid::MoveCursorRightBlock}\label{wxgridmovecursorrightblock}
1245
\func{bool}{MoveCursorRightBlock}{\param{bool }{expandSelection}}
1247
Moves the grid cursor right in the current row such that it skips to the beginning or
1248
end of a block of non-empty cells. If a block of cells was previously selected it
1249
will expand if the argument is true or be cleared if the argument is false.
1251
\wxheading{Keyboard}\\
1252
This function is called for the Ctrl+Right key combination. Shift+Ctrl+Right expands a selection.
1256
\membersection{wxGrid::MoveCursorUpBlock}\label{wxgridmovecursorupblock}
1258
\func{bool}{MoveCursorUpBlock}{\param{bool }{expandSelection}}
1260
Moves the grid cursor up in the current column such that it skips to the beginning or
1261
end of a block of non-empty cells. If a block of cells was previously selected it
1262
will expand if the argument is true or be cleared if the argument is false.
1264
\wxheading{Keyboard}\\
1265
This function is called for the Ctrl+Up key combination. Shift+Ctrl+Up expands a selection.
1269
\membersection{wxGrid::MovePageDown}\label{wxgridmovepagedown}
1271
\func{bool}{MovePageDown}{\void}
1273
Moves the grid cursor down by some number of rows so that the previous bottom visible row
1274
becomes the top visible row.
1276
\wxheading{Keyboard}\\
1277
This function is called for PgDn keypresses.
1281
\membersection{wxGrid::MovePageUp}\label{wxgridmovepageup}
1283
\func{bool}{MovePageUp}{\void}
1285
Moves the grid cursor up by some number of rows so that the previous top visible row
1286
becomes the bottom visible row.
1288
\wxheading{Keyboard}\\
1289
This function is called for PgUp keypresses.
1293
\membersection{wxGrid::RegisterDataType}\label{wxgridregisterdatatype}
1295
\func{void}{RegisterDataType}{\param{const wxString\& }{typeName}, \param{wxGridCellRenderer* }{renderer}, \param{wxGridCellEditor* }{editor}}
1297
Methods for a registry for mapping data types to Renderers/Editors
1301
\membersection{wxGrid::SaveEditControlValue}\label{wxgridsaveeditcontrolvalue}
1303
\func{void}{SaveEditControlValue}{\void}
1305
Sets the value of the current grid cell to the current in-place edit control value.
1306
This is called automatically when the grid cursor moves from the current cell to a
1307
new cell. It is also a good idea to call this function when closing a grid since
1308
any edits to the final cell location will not be saved otherwise.
1312
\membersection{wxGrid::SelectAll}\label{wxgridselectall}
1314
\func{void}{SelectAll}{\void}
1316
Selects all cells in the grid.
1320
\membersection{wxGrid::SelectBlock}\label{wxgridselectblock}
1322
\func{void}{SelectBlock}{\param{int }{topRow}, \param{int }{leftCol},
1323
\param{int }{bottomRow}, \param{int }{rightCol}, \param{bool }{addToSelected = false}}
1325
\func{void}{SelectBlock}{\param{const wxGridCellCoords\& }{topLeft},
1326
\param{const wxGridCellCoords\& }{bottomRight}, \param{bool }{addToSelected = false}}
1328
Selects a rectangular block of cells. If addToSelected is false then any existing selection will be
1329
deselected; if true the column will be added to the existing selection.
1333
\membersection{wxGrid::SelectCol}\label{wxgridselectcol}
1335
\func{void}{SelectCol}{\param{int }{col}, \param{bool }{addToSelected = false}}
1337
Selects the specified column. If addToSelected is false then any existing selection will be
1338
deselected; if true the column will be added to the existing selection.
1342
\membersection{wxGrid::SelectionToDeviceRect}\label{wxgridselectiontodevicerect}
1344
\func{wxRect}{SelectionToDeviceRect}{\void}
1346
This function returns the rectangle that encloses the selected cells
1347
in device coords and clipped to the client size of the grid window.
1351
\membersection{wxGrid::SelectRow}\label{wxgridselectrow}
1353
\func{void}{SelectRow}{\param{int }{row}, \param{bool }{addToSelected = false}}
1355
Selects the specified row. If addToSelected is false then any existing selection will be
1356
deselected; if true the row will be added to the existing selection.
1360
\membersection{wxGrid::SetCellAlignment}\label{wxgridsetcellalignment}
1362
\func{void}{SetCellAlignment}{\param{int }{row}, \param{int }{col}, \param{int }{horiz}, \param{int }{vert}}
1364
\func{void}{SetCellAlignment}{\param{int }{align}, \param{int }{row}, \param{int }{col}}
1366
Sets the horizontal and vertical alignment for grid cell text at the specified location.
1368
Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT. \\
1369
Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
1373
\membersection{wxGrid::SetCellBackgroundColour}\label{wxgridsetcellbackgroundcolour}
1375
\func{void}{SetCellBackgroundColour}{\param{int }{row}, \param{int }{col}, \param{const wxColour\&}{ colour}}
1379
\membersection{wxGrid::SetCellEditor}\label{wxgridsetcelleditor}
1381
\func{void}{SetCellEditor}{\param{int }{row}, \param{int }{col}, \param{wxGridCellEditor* }{editor}}
1383
Sets the editor for the grid cell at the specified location.
1384
The grid will take ownership of the pointer.
1386
See \helpref{wxGridCellEditor}{wxgridcelleditor} and
1387
the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1391
\membersection{wxGrid::SetCellFont}\label{wxgridsetcellfont}
1393
\func{void}{SetCellFont}{\param{int }{row}, \param{int }{col}, \param{const wxFont\&}{ font}}
1395
Sets the font for text in the grid cell at the specified location.
1399
\membersection{wxGrid::SetCellRenderer}\label{wxgridsetcellrenderer}
1401
\func{void}{SetCellRenderer}{\param{int }{row}, \param{int }{col}, \param{wxGridCellRenderer* }{renderer}}
1403
Sets the renderer for the grid cell at the specified location.
1404
The grid will take ownership of the pointer.
1406
See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
1407
the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1411
\membersection{wxGrid::SetCellTextColour}\label{wxgridsetcelltextcolour}
1413
\func{void}{SetCellTextColour}{\param{int }{row}, \param{int }{col}, \param{const wxColour\&}{ colour}}
1415
\func{void}{SetCellTextColour}{\param{const wxColour\& }{val}, \param{int }{row}, \param{int }{col}}
1417
\func{void}{SetCellTextColour}{\param{const wxColour\& }{colour}}
1419
Sets the text colour for the grid cell at the specified location.
1423
\membersection{wxGrid::SetCellValue}\label{wxgridsetcellvalue}
1425
\func{void}{SetCellValue}{\param{int }{row}, \param{int }{col}, \param{const wxString\& }{s}}
1427
\func{void}{SetCellValue}{\param{const wxGridCellCoords\& }{coords}, \param{const wxString\& }{s}}
1429
\func{void}{SetCellValue}{\param{const wxString\& }{val}, \param{int }{row}, \param{int }{col}}
1431
Sets the string value for the cell at the specified location. For simple applications where a
1432
grid object automatically uses a default grid table of string values you use this function together
1433
with \helpref{wxGrid::GetCellValue}{wxgridgetcellvalue} to access cell values.
1435
For more complex applications where you have derived your own grid table class that contains
1436
various data types (e.g. numeric, boolean or user-defined custom types) then you only use this
1437
function for those cells that contain string values.
1439
The last form is for backward compatibility only.
1441
See \helpref{wxGridTableBase::CanSetValueAs}{wxgridtablebasecangetvalueas}
1442
and the \helpref{wxGrid overview}{gridoverview} for more information.
1446
\membersection{wxGrid::SetColAttr}\label{wxgridsetcolattr}
1448
\func{void}{SetColAttr}{\param{int }{col}, \param{wxGridCellAttr* }{attr}}
1450
Sets the cell attributes for all cells in the specified column.
1452
For more information about controlling grid cell attributes see the
1453
\helpref{wxGridCellAttr}{wxgridcellattr} cell attribute class and the
1454
\helpref{wxGrid classes overview}{gridoverview}.
1458
\membersection{wxGrid::SetColFormatBool}\label{wxgridsetcolformatbool}
1460
\func{void}{SetColFormatBool}{\param{int }{col}}
1462
Sets the specified column to display boolean values. wxGrid displays boolean values with a checkbox.
1466
\membersection{wxGrid::SetColFormatNumber}\label{wxgridsetcolformatnumber}
1468
\func{void}{SetColFormatNumber}{\param{int }{col}}
1470
Sets the specified column to display integer values.
1474
\membersection{wxGrid::SetColFormatFloat}\label{wxgridsetcolformatfloat}
1476
\func{void}{SetColFormatFloat}{\param{int }{col}, \param{int }{width = -1}, \param{int }{precision = -1}}
1478
Sets the specified column to display floating point values with the given width and precision.
1482
\membersection{wxGrid::SetColFormatCustom}\label{wxgridsetcolformatcustom}
1484
\func{void}{SetColFormatCustom}{\param{int }{col}, \param{const wxString\& }{typeName}}
1486
Sets the specified column to display data in a custom format.
1487
See the \helpref{wxGrid overview}{gridoverview} for more information on working
1488
with custom data types.
1492
\membersection{wxGrid::SetColLabelAlignment}\label{wxgridsetcollabelalignment}
1494
\func{void}{SetColLabelAlignment}{\param{int }{horiz}, \param{int }{vert}}
1496
Sets the horizontal and vertical alignment of column label text.
1498
Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
1500
Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
1504
\membersection{wxGrid::SetColLabelSize}\label{wxgridsetcollabelsize}
1506
\func{void}{SetColLabelSize}{\param{int }{height}}
1508
Sets the height of the column labels.
1512
\membersection{wxGrid::SetColLabelValue}\label{wxgridsetcollabelvalue}
1514
\func{void}{SetColLabelValue}{\param{int }{col}, \param{const wxString\&}{ value}}
1516
Set the value for the given column label. If you are using a derived grid table you must
1517
override \helpref{wxGridTableBase::SetColLabelValue}{wxgridtablebasesetcollabelvalue}
1518
for this to have any effect.
1522
\membersection{wxGrid::SetColMinimalWidth}\label{wxgridsetcolminimalwidth}
1524
\func{void}{SetColMinimalWidth}{\param{int }{col}, \param{int }{width}}
1526
Sets the minimal width for the specified column. This should normally be called when creating the grid
1527
because it will not resize a column that is already narrower than the minimal width.
1528
The width argument must be higher than the minimimal acceptable column width, see
1529
\helpref{wxGrid::GetColMinimalAcceptableWidth}{wxgridgetcolminimalacceptablewidth}.
1533
\membersection{wxGrid::SetColMinimalAcceptableWidth}\label{wxgridsetcolminimalacceptablewidth}
1535
\func{void}{SetColMinimalAcceptableWidth}{\param{int }{width}}
1537
This modifies the minimum column width that can be handled correctly. Specifying a low value here
1538
allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller
1539
than the actual minimum size will incur a performance penalty in the functions which perform
1540
grid cell index lookup on the basis of screen coordinates.
1541
This should normally be called when creating the grid because it will not resize existing columns
1542
with sizes smaller than the value specified here.
1546
\membersection{wxGrid::SetColSize}\label{wxgridsetcolsize}
1548
\func{void}{SetColSize}{\param{int }{col}, \param{int }{width}}
1550
Sets the width of the specified column.
1552
This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch
1553
block you can use \helpref{wxGrid::ForceRefresh}{wxgridforcerefresh} to see the changes.
1555
Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
1556
also be set as the minimal width for the column.
1559
wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
1560
The memory requirements for this could become prohibitive if your grid is very large.
1564
\membersection{wxGrid::SetDefaultCellAlignment}\label{wxgridsetdefaultcellalignment}
1566
\func{void}{SetDefaultCellAlignment}{\param{int }{horiz}, \param{int }{vert}}
1568
Sets the default horizontal and vertical alignment for grid cell text.
1570
Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
1572
Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
1576
\membersection{wxGrid::SetDefaultCellBackgroundColour}\label{wxgridsetdefaultcellbackgroundcolour}
1578
\func{void}{SetDefaultCellBackgroundColour}{\param{const wxColour\&}{ colour}}
1580
Sets the default background colour for grid cells.
1584
\membersection{wxGrid::SetDefaultCellFont}\label{wxgridsetdefaultcellfont}
1586
\func{void}{SetDefaultCellFont}{\param{const wxFont\&}{ font}}
1588
Sets the default font to be used for grid cell text.
1592
\membersection{wxGrid::SetDefaultCellTextColour}\label{wxgridsetdefaultcelltextcolour}
1594
\func{void}{SetDefaultCellTextColour}{\param{const wxColour\&}{ colour}}
1596
Sets the current default colour for grid cell text.
1600
\membersection{wxGrid::SetDefaultEditor}\label{wxgridsetdefaulteditor}
1602
\func{void}{SetDefaultEditor}{\param{wxGridCellEditor* }{editor}}
1604
Sets the default editor for grid cells. The grid will take ownership of the pointer.
1606
See \helpref{wxGridCellEditor}{wxgridcelleditor} and
1607
the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1611
\membersection{wxGrid::SetDefaultRenderer}\label{wxgridsetdefaultrenderer}
1613
\func{void}{SetDefaultRenderer}{\param{wxGridCellRenderer* }{renderer}}
1615
Sets the default renderer for grid cells. The grid will take ownership of the pointer.
1617
See \helpref{wxGridCellRenderer}{wxgridcellrenderer} and
1618
the \helpref{wxGrid overview}{gridoverview} for more information about cell editors and renderers.
1622
\membersection{wxGrid::SetDefaultColSize}\label{wxgridsetdefaultcolsize}
1624
\func{void}{SetDefaultColSize}{\param{int }{width}, \param{bool }{resizeExistingCols = false}}
1626
Sets the default width for columns in the grid. This will only affect columns subsequently added to
1627
the grid unless resizeExistingCols is true.
1631
\membersection{wxGrid::SetDefaultRowSize}\label{wxgridsetdefaultrowsize}
1633
\func{void}{SetDefaultRowSize}{\param{int }{height}, \param{bool }{resizeExistingRows = false}}
1635
Sets the default height for rows in the grid. This will only affect rows subsequently added
1636
to the grid unless resizeExistingRows is true.
1640
\membersection{wxGrid::SetGridCursor}\label{wxgridsetgridcursor}
1642
\func{void}{SetGridCursor}{\param{int }{row}, \param{int }{col}}
1644
Set the grid cursor to the specified cell.
1645
This function calls \helpref{wxGrid::MakeCellVisible}{wxgridmakecellvisible}.
1649
\membersection{wxGrid::SetGridLineColour}\label{wxgridsetgridlinecolour}
1651
\func{void}{SetGridLineColour}{\param{const wxColour\&}{colour}}
1653
Sets the colour used to draw grid lines.
1657
\membersection{wxGrid::SetLabelBackgroundColour}\label{wxgridsetlabelbackgroundcolour}
1659
\func{void}{SetLabelBackgroundColour}{\param{const wxColour\&}{ colour}}
1661
Sets the background colour for row and column labels.
1665
\membersection{wxGrid::SetLabelFont}\label{wxgridsetlabelfont}
1667
\func{void}{SetLabelFont}{\param{const wxFont\&}{ font}}
1669
Sets the font for row and column labels.
1673
\membersection{wxGrid::SetLabelTextColour}\label{wxgridsetlabeltextcolour}
1675
\func{void}{SetLabelTextColour}{\param{const wxColour\&}{ colour}}
1677
Sets the colour for row and column label text.
1681
\membersection{wxGrid::SetMargins}\label{wxgridsetmargins}
1683
\func{void}{SetMargins}{\param{int }{extraWidth}, \param{int }{extraHeight}}
1685
A grid may occupy more space than needed for its rows/columns. This
1686
function allows to set how big this extra space is
1690
\membersection{wxGrid::SetOrCalcColumnSizes}\label{wxgridsetorcalccolumnsizes}
1692
\func{int}{SetOrCalcColumnSizes}{\param{bool }{calcOnly}, \param{bool }{setAsMin = true}}
1694
Common part of AutoSizeColumn/Row() and GetBestSize()
1698
\membersection{wxGrid::SetOrCalcRowSizes}\label{wxgridsetorcalcrowsizes}
1700
\func{int}{SetOrCalcRowSizes}{\param{bool }{calcOnly}, \param{bool }{setAsMin = true}}
1704
\membersection{wxGrid::SetReadOnly}\label{wxgridsetreadonly}
1706
\func{void}{SetReadOnly}{\param{int }{row}, \param{int }{col}, \param{bool }{isReadOnly = true}}
1708
Makes the cell at the specified location read-only or editable.
1709
See also \helpref{wxGrid::IsReadOnly}{wxgridisreadonly}.
1713
\membersection{wxGrid::SetRowAttr}\label{wxgridsetrowattr}
1715
\func{void}{SetRowAttr}{\param{int }{row}, \param{wxGridCellAttr* }{attr}}
1717
Sets the cell attributes for all cells in the specified row.
1718
See the \helpref{wxGridCellAttr}{wxgridcellattr} class for more information
1719
about controlling cell attributes.
1723
\membersection{wxGrid::SetRowLabelAlignment}\label{wxgridsetrowlabelalignment}
1725
\func{void}{SetRowLabelAlignment}{\param{int }{horiz}, \param{int }{vert}}
1727
Sets the horizontal and vertical alignment of row label text.
1729
Horizontal alignment should be one of wxALIGN\_LEFT, wxALIGN\_CENTRE or wxALIGN\_RIGHT.
1731
Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BOTTOM.
1735
\membersection{wxGrid::SetRowLabelSize}\label{wxgridsetrowlabelsize}
1737
\func{void}{SetRowLabelSize}{\param{int }{width}}
1739
Sets the width of the row labels.
1743
\membersection{wxGrid::SetRowLabelValue}\label{wxgridsetrowlabelvalue}
1745
\func{void}{SetRowLabelValue}{\param{int }{row}, \param{const wxString\&}{ value}}
1747
Set the value for the given row label. If you are using a derived grid table you must
1748
override \helpref{wxGridTableBase::SetRowLabelValue}{wxgridtablebasesetrowlabelvalue}
1749
for this to have any effect.
1753
\membersection{wxGrid::SetRowMinimalHeight}\label{wxgridsetrowminimalheight}
1755
\func{void}{SetRowMinimalHeight}{\param{int }{row}, \param{int }{height}}
1757
Sets the minimal height for the specified row. This should normally be called when creating the grid
1758
because it will not resize a row that is already shorter than the minimal height.
1759
The height argument must be higher than the minimimal acceptable row height, see
1760
\helpref{wxGrid::GetRowMinimalAcceptableHeight}{wxgridgetrowminimalacceptableheight}.
1764
\membersection{wxGrid::SetRowMinimalAcceptableHeight}\label{wxgridsetrowminimalacceptableheight}
1766
\func{void}{SetRowMinimalAcceptableHeight}{\param{int }{height}}
1768
This modifies the minimum row width that can be handled correctly. Specifying a low value here
1769
allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller
1770
than the actual minimum size will incur a performance penalty in the functions which perform
1771
grid cell index lookup on the basis of screen coordinates.
1772
This should normally be called when creating the grid because it will not resize existing rows
1773
with sizes smaller than the value specified here.
1777
\membersection{wxGrid::SetRowSize}\label{wxgridsetrowsize}
1779
\func{void}{SetRowSize}{\param{int }{row}, \param{int }{height}}
1781
Sets the height of the specified row.
1783
This function does not refresh the grid. If you are calling it outside of a BeginBatch / EndBatch
1784
block you can use \helpref{wxGrid::ForceRefresh}{wxgridforcerefresh} to see the changes.
1786
Automatically sizes the column to fit its contents. If setAsMin is true the calculated width will
1787
also be set as the minimal width for the column.
1791
wxGrid sets up arrays to store individual row and column sizes when non-default sizes are used.
1792
The memory requirements for this could become prohibitive if your grid is very large.
1796
\membersection{wxGrid::SetScrollLineX}\label{wxgridsetscrolllinex}
1798
\func{void}{SetScrollLineX}{\param{int }{x}}
1800
Sets the number of pixels per horizontal scroll increment. The default is 15.
1801
Sometimes wxGrid has trouble setting the scrollbars correctly due to rounding
1802
errors: setting this to 1 can help.
1804
\wxheading{See also}
1806
\helpref{wxGrid::GetScrollLineX}{wxgridgetscrolllinex},\rtfsp
1807
\helpref{wxGrid::GetScrollLineY}{wxgridgetscrollliney},\rtfsp
1808
\helpref{wxGrid::SetScrollLineY}{wxgridsetscrollliney}
1812
\membersection{wxGrid::SetScrollLineY}\label{wxgridsetscrollliney}
1814
\func{void}{SetScrollLineY}{\param{int }{y}}
1816
Sets the number of pixels per vertical scroll increment. The default is 15.
1817
Sometimes wxGrid has trouble setting the scrollbars correctly due to rounding
1818
errors: setting this to 1 can help.
1820
\wxheading{See also}
1822
\helpref{wxGrid::GetScrollLineX}{wxgridgetscrolllinex},\rtfsp
1823
\helpref{wxGrid::GetScrollLineY}{wxgridgetscrollliney},\rtfsp
1824
\helpref{wxGrid::SetScrollLineX}{wxgridsetscrolllinex}
1828
\membersection{wxGrid::SetSelectionBackground}\label{wxgridsetselectionbackground}
1830
\func{void}{SetSelectionBackground}{\param{const wxColour\& }{c}}
1834
\membersection{wxGrid::SetSelectionForeground}\label{wxgridsetselectionforeground}
1836
\func{void}{SetSelectionForeground}{\param{const wxColour\& }{c}}
1840
\membersection{wxGrid::SetSelectionMode}\label{wxgridsetselectionmode}
1842
\func{void}{SetSelectionMode}{\param{wxGrid::wxGridSelectionModes}{ selmode}}
1844
Set the selection behaviour of the grid.
1846
\wxheading{Parameters}
1848
\docparam{wxGrid::wxGridSelectCells}{The default mode where individual cells are selected.}
1850
\docparam{wxGrid::wxGridSelectRows}{Selections will consist of whole rows.}
1852
\docparam{wxGrid::wxGridSelectColumns}{Selections will consist of whole columns.}
1856
\membersection{wxGrid::SetTable}\label{wxgridsettable}
1858
\func{bool}{SetTable}{\param{wxGridTableBase* }{table}, \param{bool }{takeOwnership = false}, \param{wxGrid::wxGridSelectionModes }{selmode = wxGrid::wxGridSelectCells}}
1860
Passes a pointer to a custom grid table to be used by the grid. This should be called
1861
after the grid constructor and before using the grid object. If takeOwnership is set to
1862
true then the table will be deleted by the wxGrid destructor.
1864
Use this function instead of \helpref{wxGrid::CreateGrid}{wxgridcreategrid} when your
1865
application involves complex or non-string data or data sets that are too large to fit
1870
\membersection{wxGrid::ShowCellEditControl}\label{wxgridshowcelleditcontrol}
1872
\func{void}{ShowCellEditControl}{\void}
1874
Displays the in-place cell edit control for the current cell.
1878
\membersection{wxGrid::XToCol}\label{wxgridxtocol}
1880
\func{int}{XToCol}{\param{int }{x}}
1882
Returns the grid column that corresponds to the logical x coordinate. Returns
1883
{\tt wxNOT\_FOUND} if there is no column at the x position.
1887
\membersection{wxGrid::XToEdgeOfCol}\label{wxgridxtoedgeofcol}
1889
\func{int}{XToEdgeOfCol}{\param{int }{x}}
1891
Returns the column whose right hand edge is close to the given logical x position.
1892
If no column edge is near to this position {\tt wxNOT\_FOUND} is returned.
1896
\membersection{wxGrid::YToEdgeOfRow}\label{wxgridytoedgeofrow}
1898
\func{int}{YToEdgeOfRow}{\param{int }{y}}
1900
Returns the row whose bottom edge is close to the given logical y position.
1901
If no row edge is near to this position {\tt wxNOT\_FOUND} is returned.
1905
\membersection{wxGrid::YToRow}\label{wxgridytorow}
1907
\func{int}{YToRow}{\param{int }{y}}
1909
Returns the grid row that corresponds to the logical y coordinate. Returns
1910
{\tt wxNOT\_FOUND} if there is no row at the y position.