[EMAIL PROTECTED] wrote:
> Paul,
> Thank you...and Ed, of course, very much for all your help recently.
> 
> Just one more item...for now anyway...If I use the code below (note the
> added regid to the object and initialize to an integer), then the backspace
> works but the left and right arrow do not.   Is this the way it is supposed
> to work?

You had 3 problems:

1) a.Mainform -> a.MainForm
2) mytest.value=0 -> mytest.Value = 0
3) you didn't put in the test for keyChar being None, so that exception 
was still being raised with special keys like the arrows, resulting in 
the event being effectively stopped.

#2 wouldn't have affected the results, but it would have caused you 
other grief.

#1 caused the script not to run at all.


Here's the code:


import dabo
dabo.ui.loadUI("wx")
from dabo.ui import dKeys as dKeys

class Tb(dabo.ui.dTextBox):
         def initEvents(self):
                 self.bindEvent(dabo.dEvents.KeyChar, self._lookup)

         def _lookup(self,evt):
                 keyChar = evt.keyChar
                 if evt.keyCode in (dKeys.key_F7, dKeys.key_F4, 
dKeys.key_Return):
                         print "varietylookup"
                         thestr = self.Form.varietylookup(keyChar)
                         print "thestr", thestr
                         return
                 if keyChar is None:
                         return
                 if (keyChar in """,./<>?;':"[]\\{}|[EMAIL 
PROTECTED]&*()-_=+"""):
                         evt.stop()

a = dabo.dApp()
a.setup()
a.MainForm.addObject(Tb, RegID='mytest')
a.MainForm.mytest.Value=0
a.start()

-- 
pkm ~ http://paulmcnett.com


_______________________________________________
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/dabo-users/[EMAIL PROTECTED]

Reply via email to