]> git.saurik.com Git - wxWidgets.git/commitdiff
Added demo of handling EVT_GRID_SELECT_CELL.
authorMichael Bedward <mbedward@ozemail.com.au>
Tue, 19 Oct 1999 07:27:56 +0000 (07:27 +0000)
committerMichael Bedward <mbedward@ozemail.com.au>
Tue, 19 Oct 1999 07:27:56 +0000 (07:27 +0000)
A couple of other minor tweaks.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/newgrid/griddemo.cpp
samples/newgrid/griddemo.h

index cf9d04cba6972eddbdbee463b4eb87ec5f9171c8..47e451ef0c069842d0d8fabc481bd86a170dcf15 100644 (file)
@@ -68,6 +68,7 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame )
     EVT_GRID_CELL_LEFT_CLICK( GridFrame::OnCellLeftClick )
     EVT_GRID_ROW_SIZE( GridFrame::OnRowSize )
     EVT_GRID_COL_SIZE( GridFrame::OnColSize )
+    EVT_GRID_SELECT_CELL( GridFrame::OnSelectCell )
     EVT_GRID_RANGE_SELECT( GridFrame::OnRangeSelected )
     EVT_GRID_CELL_CHANGE( GridFrame::OnCellValueChanged )
 END_EVENT_TABLE()
@@ -443,20 +444,22 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
     logBuf = "";
     if ( ev.GetRow() != -1 )
     {
-        logBuf << "row label " << ev.GetRow();
+        logBuf << "Left click on row label " << ev.GetRow();
     }
     else if ( ev.GetCol() != -1 )
     {
-        logBuf << "col label " << ev.GetCol();
+        logBuf << "Left click on col label " << ev.GetCol();
     }
     else
     {
-        logBuf << "corner label";
+        logBuf << "Left click on corner label";
     }
 
     if ( ev.ShiftDown() ) logBuf << " (shift down)";
     wxLogMessage( "%s", logBuf.c_str() );
     
+    // you must call event skip if you want default grid processing
+    //
     ev.Skip();
 }
 
@@ -464,7 +467,7 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
 void GridFrame::OnCellLeftClick( wxGridEvent& ev )
 {
     logBuf = "";
-    logBuf << "Cell at row " << ev.GetRow()
+    logBuf << "Left click at row " << ev.GetRow()
            << " col " << ev.GetCol();
     wxLogMessage( "%s", logBuf.c_str() );
 
@@ -494,6 +497,19 @@ void GridFrame::OnColSize( wxGridSizeEvent& ev )
     ev.Skip();
 }
 
+
+void GridFrame::OnSelectCell( wxGridEvent& ev )
+{
+    logBuf = "";
+    logBuf << "Selected cell at row " << ev.GetRow()
+           << " col " << ev.GetCol();
+    wxLogMessage( "%s", logBuf.c_str() );
+    
+    // you must call Skip() if you want the default processing
+    // to occur in wxGrid
+    ev.Skip();
+}
+
 void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev )
 {
     logBuf = "";
index 77510d31882087d4e0e53460c349a476945f2d65..56d10dee2a71b95e591d9da82dc1e5a2545744d1 100644 (file)
@@ -54,6 +54,7 @@ class GridFrame : public wxFrame
     void OnCellLeftClick( wxGridEvent& );
     void OnRowSize( wxGridSizeEvent& );
     void OnColSize( wxGridSizeEvent& );
+    void OnSelectCell( wxGridEvent& );
     void OnRangeSelected( wxGridRangeSelectEvent& );
     void OnCellValueChanged( wxGridEvent& );