]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/tgrid.tex
Moved '\label' tag to the correct line, allowing tex2rtf to correctly build docs
[wxWidgets.git] / docs / latex / wx / tgrid.tex
1 \section{wxGrid classes overview}\label{gridoverview}
2
3 Classes: \helpref{wxGrid}{wxgrid}
4
5 \subsection{Introduction}
6 wxGrid and its related classes are used for displaying and editing tabular data.
7
8 \subsection{Getting started: a simple example}
9 For simple applications you need only refer to the wxGrid class in your
10 code. This example shows how you might create a grid in a frame or
11 dialog constructor and illustrates some of the formatting functions.
12
13 \begin{verbatim}
14
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");
49
50 \end{verbatim}
51
52 \subsection{A more complex example}
53 Yet to be written
54
55 \subsection{How the wxGrid classes relate to each other}
56 Yet to be written
57
58 \subsection{Keyboard and mouse actions}
59 Yet to be written
60