Code Comments
Programming Forum and web based access to our favorite programming groups.I want to run a proc in response to either the physical keyboard or a
virtual on-screen keyboard. Tis means I need to bind to ButtonPress and
KeyPress. When I try this I get the physical keyboard events just fine but
no response to button clicks. See below:
Why is this not working?
Thanks!
Phil
bind .dialog.t <KeyPress> {
OnKeyPress . %A %K %s
}
bind .dialog.t <KeyRelease> {
OnKeyRelease . %A %K %s
}
bind .dialog.t <ButtonPress> {
OnKeyPress . %A %K %s
}
bind .dialog.t <ButtonRelease> {
OnKeyRelease . %A %K %s
}
Post Follow-up to this messageBruce, What you say much good sense. Something I seem to be lacking at the moment. The .dialog.t window is a text widget that everything winds up go to. After I read your reply I simply tried clicking on the text window and low-and-behold it worked as you said. I will take your advice and use the -command option for each button to do teh processing I want to do. That method seemse to make the most sense. Thanks! "Bruce Hartweg" <bruce-news@hartweg.us> wrote in message news:HF8ed.4$Sg.0@dfw-service2.ext.ray.com... > > > Phil Biehl wrote: > > > what kind of widget is .dialog.t ? > keyboard events go to the widget that has focus, > but button event go to the widget that the > pointer is over, so if you have buttons that > are your virtual keyboard, then these are what get > the mouse event. If they are in fact buttons, you > don't need to bind to them, just use their -command > option. The easiest way to make that work would to > just have your button commands use event generate > to to create a <KeyPress> event for the currently > focused window. If your app is all on one screen, > you can just deliver the event to the top level window > and it will go to the currently focused window. > If your app is multiple windows, use the [focus] > command to determine where to send it. > > If you do this, then even widgets that you don't > have special Key bindings for will still work (i.e. > typing into a text or entry widget will work as-is > > Bruce >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.