dabo Commit
Revision 4820
Date: 2008-12-11 10:51:51 -0800 (Thu, 11 Dec 2008)
Author: Paul
Trac: http://trac.dabodev.com/dabo/changeset/4820

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

Log:
Windows doesn't provide an automatic binding to Ctrl+A for Select All. This 
becomes an issue when an Edit menu isn't around, such as in a dDialog. Fixed. 
Also, Added code so a control's StatusText is shown when the control gets the 
focus, not merely when the mouse hovers over the control.

Diff:
Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2008-12-11 18:15:01 UTC (rev 4819)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2008-12-11 18:51:51 UTC (rev 4820)
@@ -450,7 +450,16 @@
                                continue
                        self.bindEvent(evt, mthd)
 
+       def _popStatusText(self):
+               if self.StatusText and self.Form is not None:
+                       self.Form.setStatusText("")
 
+       def _pushStatusText(self):
+               st = self.StatusText
+               if st and self.Form is not None:
+                       self.Form.setStatusText(st)
+
+
        def __onMouseEnter(self, evt):
                if self._hover:
                        if self._hoverTimer is None:
@@ -514,6 +523,7 @@
 
                
        def __onWxGotFocus(self, evt):
+               self._pushStatusText()
                if isinstance(self, dabo.ui.dGrid):
                        ## Continuation of ugly workaround for grid focus 
event. Only raise the
                        ## Dabo event if we are reasonably sure it isn't a 
repeat.
@@ -529,6 +539,16 @@
 
                
        def __onWxKeyUp(self, evt):
+               if sys.platform.startswith("win"):
+                       # Windows doesn't automatically catch Ctrl+A
+                       ctrl = evt.ControlDown()
+                       kc = evt.GetRawKeyCode()
+                       try:
+                               char = chr(kc).lower()
+                       except ValueError:
+                               char = None
+                       if ctrl and char == "a":
+                               self.selectAll()
                self.raiseEvent(dEvents.KeyUp, evt)
 
                
@@ -539,6 +559,7 @@
        def __onWxLostFocus(self, evt):
                if self._finito:
                        return
+               self._popStatusText()
                self.raiseEvent(dEvents.LostFocus, evt)
        
 
@@ -549,17 +570,13 @@
        
 
        def __onWxMouseEnter(self, evt):
-               st = self.StatusText
-               if st is not None and self.Form is not None:
-                       self.Form.setStatusText(st)
+               self._pushStatusText()
                self.raiseEvent(dEvents.MouseEnter, evt)
                
 
        def __onWxMouseLeave(self, evt):
+               self._popStatusText()
                self._mouseLeftDown, self._mouseRightDown = False, False
-               st = self.StatusText
-               if st is not None and self.Form is not None:
-                       self.Form.setStatusText("")
                self.raiseEvent(dEvents.MouseLeave, evt)
                
 
@@ -2713,8 +2730,14 @@
                        _("The sizer for the object.") )
 
        StatusText = property(_getStatusText, _setStatusText, None,
-                       _("Specifies the text that displays in the form's 
status bar, if any."))
+                       _("""Specifies the text that displays in the form's 
status bar, if any.
 
+                       The text will appear when the control gets the focus, 
or when the
+                       mouse hovers over the control, and will clear when the 
control loses
+                       the focus, or when the mouse is no longer hovering.
+
+                       For forms, set StatusText whenever you want to display 
a message."""))
+
        Tag = property(_getTag, _setTag, None,
                        _("A property that user code can safely use for 
specific purposes.") )
                




_______________________________________________
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