]> git.saurik.com Git - wxWidgets.git/commitdiff
right clicking outside any column sets the column in the list event to -1, not the...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 11 Mar 2002 12:32:56 +0000 (12:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 11 Mar 2002 12:32:56 +0000 (12:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/listevt.tex
samples/listctrl/listtest.cpp
src/generic/listctrl.cpp

index 57ee3e4262e4eabd1f7859b526da23bb54f07737..2c47de8d20ba0d156427fa9250920cd55a8df19e 100644 (file)
@@ -37,7 +37,7 @@ functions that take a wxListEvent argument.
 \twocolitem{{\bf EVT\_LIST\_KEY\_DOWN(id, func)}}{A key has been pressed.}
 \twocolitem{{\bf EVT\_LIST\_INSERT\_ITEM(id, func)}}{An item has been inserted.}
 \twocolitem{{\bf EVT\_LIST\_COL\_CLICK(id, func)}}{A column ({\bf m\_col}) has been left-clicked.}
 \twocolitem{{\bf EVT\_LIST\_KEY\_DOWN(id, func)}}{A key has been pressed.}
 \twocolitem{{\bf EVT\_LIST\_INSERT\_ITEM(id, func)}}{An item has been inserted.}
 \twocolitem{{\bf EVT\_LIST\_COL\_CLICK(id, func)}}{A column ({\bf m\_col}) has been left-clicked.}
-\twocolitem{{\bf EVT\_LIST\_COL\_RIGHT\_CLICK(id, func)}}{A column ({\bf m\_col}) has been right-clicked.}
+\twocolitem{{\bf EVT\_LIST\_COL\_RIGHT\_CLICK(id, func)}}{A column ({\bf m\_col}) (which can be $-1$ if the click occured outside any column) has been right-clicked.}
 \twocolitem{{\bf EVT\_LIST\_COL\_BEGIN\_DRAG(id, func)}}{The user started resizing a column - can be vetoed.}
 \twocolitem{{\bf EVT\_LIST\_COL\_DRAGGING(id, func)}}{The divider between columns is being dragged.}
 \twocolitem{{\bf EVT\_LIST\_COL\_END\_DRAG(id, func)}}{A column has been resized by the user.}
 \twocolitem{{\bf EVT\_LIST\_COL\_BEGIN\_DRAG(id, func)}}{The user started resizing a column - can be vetoed.}
 \twocolitem{{\bf EVT\_LIST\_COL\_DRAGGING(id, func)}}{The divider between columns is being dragged.}
 \twocolitem{{\bf EVT\_LIST\_COL\_END\_DRAG(id, func)}}{A column has been resized by the user.}
index c1fd9dc512a859a5ef59b6ad80fc71a6bd775144..7b196adf035514b9df1732ab6aac2547d65206c3 100644 (file)
@@ -631,7 +631,10 @@ void MyListCtrl::OnColClick(wxListEvent& event)
 void MyListCtrl::OnColRightClick(wxListEvent& event)
 {
     int col = event.GetColumn();
 void MyListCtrl::OnColRightClick(wxListEvent& event)
 {
     int col = event.GetColumn();
-    SetColumnImage(col, -1);
+    if ( col != -1 )
+    {
+        SetColumnImage(col, -1);
+    }
 
     wxLogMessage( wxT("OnColumnRightClick at %d."), event.GetColumn() );
 }
 
     wxLogMessage( wxT("OnColumnRightClick at %d."), event.GetColumn() );
 }
index 79c094ccf7bbcbce6a5f928bb3f70b865cda3cf7..7c8f47927acaf5abda6ad6842e59adc68edecf65 100644 (file)
@@ -435,7 +435,7 @@ protected:
     wxCursor          *m_resizeCursor;
     bool               m_isDragging;
 
     wxCursor          *m_resizeCursor;
     bool               m_isDragging;
 
-    // column being resized
+    // column being resized or -1
     int m_column;
 
     // divider line position in logical (unscrolled) coords
     int m_column;
 
     // divider line position in logical (unscrolled) coords
@@ -2022,8 +2022,9 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
         int xpos = 0;
 
         // find the column where this event occured
         int xpos = 0;
 
         // find the column where this event occured
-        int countCol = m_owner->GetColumnCount();
-        for (int col = 0; col < countCol; col++)
+        int col,
+            countCol = m_owner->GetColumnCount();
+        for (col = 0; col < countCol; col++)
         {
             xpos += m_owner->GetColumnWidth( col );
             m_column = col;
         {
             xpos += m_owner->GetColumnWidth( col );
             m_column = col;
@@ -2044,6 +2045,9 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
             m_minX = xpos;
         }
 
             m_minX = xpos;
         }
 
+        if ( col == countCol )
+            m_column = -1;
+
         if (event.LeftDown() || event.RightUp())
         {
             if (hit_border && event.LeftDown())
         if (event.LeftDown() || event.RightUp())
         {
             if (hit_border && event.LeftDown())