On Jun 8, 2006, at 10:38 AM, Henning Hraban Ramm wrote:
- how can I limit some text entry to e.g. numbers or lowercase letters
You can bind the dEvents.KeyChar event of the textbox to a method
that then checks the pressed key to make sure it's acceptable. The
code would look like:
self.txtPropName.bindEvent(dEvents.KeyChar, self.onKeyCheck)
... followed by:
def onKeyCheck(self, evt):
if not evt.keyChar.islower():
evt.stop()
This will intercept all keystrokes, and if it is lower case, the
character will not be added to the textbox.
Right now there is no way to change the character (e.g., force all
characters to be upper case), but you can always use the
dabo.ui.callAfter() function plus a simple custom function to do this
for you:
def onKeyCheck(self, evt):
dabo.ui.callAfter(self.toUpper)
def toUpper(self):
self.Value = self.Value.upper()
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users