Re: invoking
- From: Ron Fox <fox@xxxxxxxxxxxx>
- Date: Fri, 30 May 2008 07:05:13 -0400
You could process focus out events to force focus back to the appropriate button.. unless the user has to interact with the user interface while processing.
RF
Ralf Fassel wrote:
In my app I have a Start and a Stop button which start/stop processing.
When the focus is on 'Start', pressing the space key starts processing
and sets the focus to 'Stop', so that I can press space again and stop
the processing (which sets the focus back to 'Start' etc).
This works as long as the focus stays on Start. Sometimes some other
widget takes the focus, and then this no longer works.
When I simply
bind . <space> doStartStop
then I call doStartStop even from e.g. entries which should not invoke
it. I would have to disable the {.}-binding in all those entries
which is a bit tedious, dito for checkbuttons etc.
Using virtual events:
bind {.} <<MyEvent>> {doStartStop %W}
bind {.} <space> {event generate %W <<MyEvent>>}
# now disable all those which have space default behaviour
bind Entry <<MyEvent>> {break}
bind Button <<MyEvent>> {break}
...
# Hope I don't miss any... :-/
pack [entry .e] [button .b -command "doStartStop from btn"]
bind . <Escape> {focus .}
proc doStartStop {args} {
puts "doStartStop $args"
}
Or *add* <<MyEvent>> to all widgets/classes which should handle the
space key as start/stop?
Or just make <Escape> re/set the focus to the Start/Stop button?
I'm sure there is a better way, I just don't get it.
R'
--
Ron Fox
NSCL
Michigan State University
East Lansing, MI 48824-1321
.
- Follow-Ups:
- Re: invoking
- From: Gerald W. Lester
- Re: invoking
- References:
- invoking
- From: Ralf Fassel
- invoking
- Prev by Date: Re: Snit Problem- Invalid command name
- Next by Date: Re: Tcl_Init error - too many nested evaluations
- Previous by thread: Re: invoking
- Next by thread: Re: invoking
- Index(es):