The first two were typo's in the email....sorry.

I think I see the issue with the arrows and other keys.

If I add a "print keyChar" right after the "keyChar = evt.keyChar" statement
and watch the output, the arrows and other special keys are being
interpreted as ones in the ignore list further down in the code.  i.e.
backarrow='%', etc.


Thanks.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul McNett
Sent: Wednesday, April 11, 2007 1:28 AM
To: Dabo Users list
Subject: Re: [dabo-users] Textbox - backspace, delete, left & right arrows
dont work

[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]

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 269.0.0/754 - Release Date: 09-Apr-2007
10:59 PM
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 269.0.0/754 - Release Date: 09-Apr-2007
10:59 PM
 


_______________________________________________
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