Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

binding to mouse buttons & keyboard
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
}



Report this thread to moderator Post Follow-up to this message
Old Post
Phil Biehl
10-22-04 01:56 PM


Re: binding to mouse buttons & keyboard
Bruce,
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
>



Report this thread to moderator Post Follow-up to this message
Old Post
Phil Biehl
10-23-04 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Tcl archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:37 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.