contents up previous next

wxgrid classes overview

classes: wxgrid

introduction
getting started: a simple example
a more complex example
how the wxgrid classes relate to each other
keyboard and mouse actions


introduction

wxgrid and its related classes are used for displaying and editing tabular data.


getting started: a simple example

for simple applications you need only refer to the wxgrid class in your code. this example shows how you might create a grid in a frame or dialog constructor and illustrates some of the formatting functions.

    // create a wxgrid object
    
    grid = new wxgrid( this,
                       -1,
                       wxpoint( 0, 0 ),
                       wxsize( 400, 300 ) );

    // then we call creategrid to set the dimensions of the grid
    // (100 rows and 10 columns in this example)
    grid->creategrid( 100, 10 );

    // we can set the sizes of individual rows and columns
    // in pixels
    grid->setrowsize( 0, 60 );
    grid->setcolsize( 0, 120 );
    
    // and set grid cell contents as strings
    grid->setcellvalue( 0, 0, "wxgrid is good" );

    // we can specify that some cells are read-only
    grid->setcellvalue( 0, 3, "this is read-only" );
    grid->setreadonly( 0, 3 );

    // colours can be specified for grid cell contents
    grid->setcellvalue(3, 3, "green on grey");
    grid->setcelltextcolour(3, 3, *wxgreen);
    grid->setcellbackgroundcolour(3, 3, *wxlight_grey);

    // we can specify the some cells will store numeric 
    // values rather than strings. here we set grid column 5 
    // to hold floating point values displayed with width of 6 
    // and precision of 2
    grid->setcolformatfloat(5, 6, 2);
    grid->setcellvalue(0, 6, "3.1415");


a more complex example

yet to be written


how the wxgrid classes relate to each other

yet to be written


keyboard and mouse actions

yet to be written