lux wrote:
TANKS!!!
Now it work!!!
Not so fast. I've found out that I had to do the following ugly workaround to
ensure it works in all cases:
def _initEvents(self):
...
if self.BaseClass.__name__ == "dGrid":
## Ugly workaround for grids not firing focus events from the keyboard
## correctly.
self._lastGridFocusTimestamp = 0.0
self.GetGridCornerLabelWindow().Bind(wx.EVT_SET_FO CUS, self.__onWxGotFocus)
self.GetGridColLabelWindow().Bind(wx.EVT_SET_FOCUS , self.__onWxGotFocus)
self.GetGridRowLabelWindow().Bind(wx.EVT_SET_FOCUS , self.__onWxGotFocus)
self.GetGridWindow().Bind(wx.EVT_SET_FOCUS, self.__onWxGotFocus)
self.Bind(wx.EVT_SET_FOCUS, self.__onWxGotFocus)
...
def __onWxGotFocus(self, evt):
if self.BaseClass.__name__ == "dGrid":
## Continuation of ugly workaround for grid focus event. Only raise the
## Dabo event if we are reasonably sure it isn't a repeat.
prev = self._lastGridFocusTimestamp
now = self._lastGridFocusTimestamp = time.time()
if now-prev < .05:
return
self.raiseEvent(dEvents.GotFocus, evt)
--
Paul McNett
http://paulmcnett.com http://dabodev.com