I am new to wxWidgets and ran into several issues using wxGrid.
1) according to the wxWiki, i can disable the edit box for the cell being edited only by deriving a custom class from wxGrid and overriding DrawCellHighlight:
Is there really no easier way?If you want to change the way the "Current Cell"-highlight is drawn, simply derive a class from wxGrid and override
void DrawCellHighlight(wxDC& dc, const wxGridCellAttr *attr);
Leave the method body empty to disable cell highlighting. -- chris, advised by Scott on the wx forum.
2) How can i react to changes a user makes in cells?
From php i know
but this doesnt seem to be available.wx.grid.EVT_GRID_CELL_CHANGE - Triggered when the user changes the data in a cell via an editor.
I also tried to catch keystrokes in general, but it wouldnt work like this:
Code: Select all
const int ID_TEST = 101;
wxGrid* grd = new wxGrid( this,
ID_TEST,
wxPoint( 0, 0 ),
wxSize( 400, 300 ) );
grd->GetEventHandler()->Connect(ID_TEST, wxEVT_KEY_DOWN, wxCommandEventHandler(MyWindow::Test));
3)
If i have multiple cells selected, how can i get the cell that is active, ie being edited?
4)
if i want to draw directly on a wxGrid control:
Code: Select all
void MyWindow::OnPaint(wxPaintEvent &event)
{
wxPaintDC dc(myGrid);
dc.DrawLine(50, 60, 190, 60);
}
It works fine on a plain window.
f.