On Saturday 14 February 2009 11:04:57 am Peter Seckler wrote:
> Hi everyone,
>
> if a dGrid has focus, the default behaviour if one hits -enter- is that the
> cell cursor goes one row down.
>
> Right now i writing a 'navigation dialog' (to navigate to a dataset) with
> just a grid and two buttons (OK, Cancel), and I want the OK button to be
> pushed when the user hits -enter-. Setting the 'DefaultButton' property of
> the button to True doesn't work (because the Grid catches the event before
> the dialog ?).
>
> Which event of dGrid covers the hit of -enter-? I tried the KeyEvent and
> KeyChar of the Grid, neither works.
>
> Is there a possibility to tell the Grid 'ignore that event and put it
> through to the form'?
>
> As you might guess, I'm doing my first steps in gui programming, especially
> with dabo. I'd appreciate it if someone could point me to the right
> direction.
>
> Best Regards
>
> Peter

What I'd do is catch the key events.

First make sure you have the right import's

from dabo.ui import dKeys as dKeys

Then when you create the grid you need to bind the event
mygrid= dabo.ui.dGrid(self.....)
mygrid.bindEvent(dEvents.KeyChar, self._catchRet)

def _catchRet(self,evt):
   if evt.keyCode in [dKeys.key_Return]:
      do something?????

check out 
~dabo/ui/uiwx/dKeys.py

The above is untested.  But in general it works as above for other controls.  
I'm not sure about dGrid.  Looking at the dGrid.py it binds many of the 
events so it may required that you write your own initEvents (over writing 
what was done) in a special class.  Just create a sub-class of dGrid and 
replace/or add your own initEvents.  Don't forget to include a super().
-- 
John Fabiani

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

Reply via email to