> I'm starting to work with the wxGrid widget, and wanted to know if it's
> possible to change a column from using a text control to using some other
> widget, such as a checkbox or choice list?
> If so, does anyone have any examples of how to do it?
> If not, maybe this should get put on the TODO list???
The underlying C++ wxGrid class is being completly rewritten and this is one
of the items on the list for it. Also will be a MVC architecture so you can
plug in different data models and access or generate the data displayed
however you want it.
> > The underlying C++ wxGrid class is being completly rewritten and this is
> > of the items on the list for it. Also will be a MVC architecture so you
> > plug in different data models and access or generate the data displayed
> > however you want it.
> Yippee!! Any idea when that will crystallize? I've been frustrated by
> grid control for a while and would like nothing better than to chuck it
> move to MVC.
Here's the latest things that have been said about it from the author:
>From Aug 11:
Here's a summary of the new design...
- The new design separates data model from grid view.
- The model starts with an abstract base class, wxGridTableBase, to
provide a simple API for exchanging data (in the form of strings) with
- Derived from this is wxGridTable. It simply encapsulates a 2D array
of strings to provide similar functionality to the present wxGrid where
only a small amount of data are required.
- You derive other classes to work with specific data sources. E.g.
myGridTextFileTable to work with large delimited text files;
myGridXbaseTable to work with xbase format files etc. Generally useful
types, such as the delimited text file example, could be part of the
standard wxGrid classes.
- For a small table of strings, using wxGrid would be similar to present
This would create a grid view with a fixed size of 10 rows by 5 cols
that would set up and use a wxGridTable to store string values.
- Setting up a grid to view records in a large database file would
involve a derived table class like this:
gridTable = new MyGridDBTable( "blah.dbf" );
grid = new wxGrid( this, -1, wxPoint(x, y), wxSize(w, h) );
grid->SetModel( gridTable );
The MyGridDBTable would provide methods to read/write the database file
recs and, if necessary, convert values to strings for wxGrid. The
number of data read into memory at any one time is small, just enough to
fill the grid view.
>From Aug 23
It's getting there. It now supports multi-line text in cells (not
auto-wrap yet), ESC key undo function and keyboard navigation. At the
moment I'm working on adding existing functions such as insert/append
rows/cols, setting colours, fonts etc. I tested it with a 1000x1000
string table yesterday and it seemed to work.