Re: BWidget <<TreeSelect>> + keyboard navigation
- From: Bryan Oakley <oakley@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 09:24:55 -0500
Kevin Walzer wrote:
I'm having problems with a BWidget Tree in one of my applications--it doesn't seem to fire the <<TreeSelect>> virtual event when the arrow key is pressed, either up or down. I'm binding a command to this event, so I have to get this working.
This is typical of what I've tried:
bind $Tree <KeyPress-Up> <<TreeSelect>>
Doesn't work.
Do I need to do something with [event generate] here? Has anyone found a way to implement this? I'm having some difficulty getting the syntax right.
No surprise. Look at the documentation for bind and you'll see that third argument should be the name of a script. Unless you have a procedure named <<TreeSelect>> it won't work (though, it should throw an error if the binding is being processed).
So first, you need to generate the virtual event on the keypress like so:
bind $Tree <KeyPress-Up> [list event generate $Tree <<TreeSelect>>]
Second, for this to work the tree widget has to have keyboard focus. I don't recall off hand if the BWidget sets focus on a mouse click or not. You can always add that binding yourself, or simply set the focus to the tree when your application starts up.
Finally, if you have a binding on key-up, realize that that binding will fire before the tree's class binding, and it's likely that the class binding is where the tree's notion of what is selected is updated.
--
Bryan Oakley
http://www.tclscripting.com
.
- Follow-Ups:
- Re: BWidget <<TreeSelect>> + keyboard navigation
- From: Kevin Walzer
- Re: BWidget <<TreeSelect>> + keyboard navigation
- References:
- BWidget <<TreeSelect>> + keyboard navigation
- From: Kevin Walzer
- BWidget <<TreeSelect>> + keyboard navigation
- Prev by Date: Re: Tcl script fails on some platforms
- Next by Date: Re: tclkit.exe description
- Previous by thread: BWidget <<TreeSelect>> + keyboard navigation
- Next by thread: Re: BWidget <<TreeSelect>> + keyboard navigation
- Index(es):
Relevant Pages
|