[EMAIL PROTECTED] wrote:
> I think the problem is that the default behavior is not getting called. How
> do I call it? I tried evt.super() but that throws an exception.
Okay, here you go:
> 1) Define textbox
> keybox=dabo.ui.dTextBox(self)
good
> 2) Bind event
> keybox.bindEvent(dEvents.KeyChar, self._lookup)
good
> 3) Custom eventhandler
>
> def _lookup(self,evt):
> from dabo.ui import dKeys as dKeys
> if evt.keyCode == dKeys.key_F7 or evt.keyCode == dKeys.key_F4 or
> evt.keyCode == dKeys.key_Return:
> thestr= self.Form.varietylookup(evt)
> return
> keyChar = evt.keyChar
> if (keyChar in """,./<>?;':"[]\\{}|[EMAIL PROTECTED]&*()-_=+"""):
> evt.stop()
>
> #otherwise issue default behavior
> evt.super()?
Events get continued by default in Dabo, so you don't need to call
anything like evt.super() or even set evt.Continue = True. Something
unexpected is stopping your event, so what you should do is make sure
that each block is working as expected:
##- save and run this from the command line
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 in """,./<>?;':"[]\\{}|[EMAIL
PROTECTED]&*()-_=+"""):
evt.stop()
a = dabo.dApp()
a.setup()
a.MainForm.addObject(Tb)
a.start()
When I do that, I find a TypeError exception happening in the (keyChar
in """...) test. Basically, keyChar is None so the string lookup fails.
I don't know why keyChar is None (submit a ticket please), but you can
work around by adding the test:
if keyChar is None:
return
--
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]