dabo Commit
Revision 5544
Date: 2009-12-02 10:56:29 -0800 (Wed, 02 Dec 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5544

Changed:
U   trunk/dabo/ui/uiwx/dGrid.py

Log:
Added TabNavigates property to dGrid, defaulted to True. When True, Tab will
navigate to the next control instead of to the next column in the grid.

I'm +0 for the default of True. If this is disconcerting to people, we can 
default it to False instead to have the old default behavior without having
to set the property explicitly.


Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2009-12-02 18:24:08 UTC (rev 5543)
+++ trunk/dabo/ui/uiwx/dGrid.py 2009-12-02 18:56:29 UTC (rev 5544)
@@ -1887,7 +1887,7 @@
                gridWindow.Bind(wx.EVT_RIGHT_UP, self.__onWxMouseRightUp)
                gridWindow.Bind(wx.EVT_CONTEXT_MENU, self.__onWxContextMenu)
 
-#              self.bindEvent(dEvents.KeyDown, self._onKeyDown)
+               self.bindEvent(dEvents.KeyDown, self._onKeyDown)
                self.bindEvent(dEvents.KeyChar, self._onKeyChar)
                self.bindEvent(dEvents.GridRowSize, self._onGridRowSize)
                self.bindEvent(dEvents.GridCellSelected, 
self._onGridCellSelected)
@@ -3458,8 +3458,13 @@
                self.refresh()
 
 
+       def _onKeyDown(self, evt):
+               if evt.EventData["keyCode"] == 9 and self.TabNavigates:
+                       evt.stop()
+                       self.Navigate(not evt.EventData["shiftDown"])
+
+
        def _onKeyChar(self, evt):
-       #def _onKeyDown(self, evt):
                """ Occurs when the user presses a key inside the grid."""
                if (self.Editable and self.Columns[self.CurrentColumn].Editable 
                                and not self._vetoAllEditing):
@@ -4445,6 +4450,13 @@
                self._sortable = bool(val)
 
 
+       def _getTabNavigates(self):
+               return getattr(self, "_tabNavigates", True)
+
+       def _setTabNavigates(self, val):
+               self._tabNavigates = bool(val)
+
+
        def _getVerticalScrolling(self):
                return self.GetScrollPixelsPerUnit()[1] > 0
 
@@ -4672,6 +4684,10 @@
                        and if the column's Sortable property is True, the 
column
                        will be sortable. Default: True  (bool)"""))
 
+       TabNavigates = property(_getTabNavigates, _setTabNavigates, None,
+                       _("""Specifies whether Tab navigates to the next 
control (True, the default), 
+                       or if Tab moves to the next column in the grid 
(False)."""))
+
        VerticalScrolling = property(_getVerticalScrolling, 
_setVerticalScrolling, None,
                        _("Is scrolling enabled in the vertical direction?  
(bool)"))
 
@@ -4712,6 +4728,7 @@
        DynamicShowColumnLabels = makeDynamicProperty(ShowColumnLabels)
        DynamicShowRowLabels = makeDynamicProperty(ShowRowLabels)
        DynamicSortable = makeDynamicProperty(Sortable)
+       DynamicTabNavigates = makeDynamicProperty(TabNavigates)
        DynamicVerticalScrolling = makeDynamicProperty(VerticalScrolling)
 
 



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to