]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/tgrid.tex
Patches-1851591 ] dataview sample is crashing (under MSW)
[wxWidgets.git] / docs / latex / wx / tgrid.tex
CommitLineData
a660d684
KB
1\section{wxGrid classes overview}\label{gridoverview}
2
78c49c58 3Classes: \helpref{wxGrid}{wxgrid}
a660d684 4
a203f6c0 5\subsection{Introduction}\label{introductiontowxgrid}
78c49c58 6wxGrid and its related classes are used for displaying and editing tabular data.
a660d684 7
a203f6c0 8\subsection{Getting started: a simple example}\label{simplewxgridexample}
78c49c58
MB
9For simple applications you need only refer to the wxGrid class in your
10code. This example shows how you might create a grid in a frame or
11dialog constructor and illustrates some of the formatting functions.
a660d684 12
78c49c58 13\begin{verbatim}
a660d684 14
78c49c58
MB
15 // Create a wxGrid object
16
17 grid = new wxGrid( this,
18 -1,
19 wxPoint( 0, 0 ),
20 wxSize( 400, 300 ) );
21
22 // Then we call CreateGrid to set the dimensions of the grid
23 // (100 rows and 10 columns in this example)
24 grid->CreateGrid( 100, 10 );
25
26 // We can set the sizes of individual rows and columns
27 // in pixels
28 grid->SetRowSize( 0, 60 );
29 grid->SetColSize( 0, 120 );
30
31 // And set grid cell contents as strings
32 grid->SetCellValue( 0, 0, "wxGrid is good" );
33
34 // We can specify that some cells are read-only
35 grid->SetCellValue( 0, 3, "This is read-only" );
36 grid->SetReadOnly( 0, 3 );
37
38 // Colours can be specified for grid cell contents
39 grid->SetCellValue(3, 3, "green on grey");
40 grid->SetCellTextColour(3, 3, *wxGREEN);
41 grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY);
42
43 // We can specify the some cells will store numeric
44 // values rather than strings. Here we set grid column 5
45 // to hold floating point values displayed with width of 6
46 // and precision of 2
47 grid->SetColFormatFloat(5, 6, 2);
48 grid->SetCellValue(0, 6, "3.1415");
a660d684 49
a660d684 50\end{verbatim}
78c49c58 51
a203f6c0 52\subsection{A more complex example}\label{complexwxgridexample}
78c49c58
MB
53Yet to be written
54
a203f6c0 55\subsection{How the wxGrid classes relate to each other}\label{wxgridclassesrelations}
78c49c58
MB
56Yet to be written
57
a203f6c0 58\subsection{Keyboard and mouse actions}\label{keyboardandmouseinwxgrid}
78c49c58
MB
59Yet to be written
60