I will confirm that onKeyUp is what works, that's what I use in all of
my code where I need to do something as the user is typing. For
example, here is an excerpt:

class CustomerSearchBox(TextBox, EventHandler):
    def __init__(self):
        TextBox.__init__(self, ID="search-box")
        EventHandler.__init__(self)
        self.addKeyboardListener(self)
        self.addEventType("onUserTyping")
    def onKeyUp(self, sender, keycode, modifiers):
        self.notify("onUserTyping", self.getText())
    def onKeyDown(self, sender, keycode, modifiers): pass
    def onKeyPress(self, sender, keycode, modifiers): pass


EventHandler, addEventType() and notify() are not part of pyjamas
(it's a custom framework i've built) so you will substitute whatever
you want there, but TextBox and addKeyboardListener() is part of
pyajamas.

On Tue, Nov 29, 2011 at 11:24 AM, Luke Kenneth Casson Leighton
<[email protected]> wrote:
> On Tue, Nov 29, 2011 at 1:30 PM, Lukasz Mach <[email protected]> wrote:
>
>> I started from similar option, but I realized that hints in popup are
>> always one char "late" to what you typed.
>
>  i've seen that... can't remember how/why.  i think it was something
> to do with using onKeyUp instead of onKeyPress, but some browsers
> don't do one of those... erk....
>
>  l.
>

Reply via email to