Home > Archive > Tcl > May 2006 > Is there an event for 'application activation'?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Is there an event for 'application activation'?
|
|
| Helmut Giese 2006-05-23, 7:07 pm |
| Hello out there,
I have a setup where
- my app launches the user's browser towards a certain URL
- where the user is supposed to do something and when
- he/she returns to my app processing is to continue - based on what
the user did with the browser.
I thought I could bind on the <Activate> event to get notified when my
app is "activated" again, but a naive (?) attempt like
bind . <Activate> {puts "active"}
didn't result in anything.
Is this feature even implemented? It does exist, of course, on
Windows, but maybe Tk doesn't make use of it. Or my [bind]ing is wrong
or I just misunderstood something.
Any insight in this matter will be greatly appreciated.
Best regards
Helmut Giese
| |
| Wojciech Kocjan 2006-05-24, 4:14 am |
| On Tue, 23 May 2006 21:05:52 +0200, Helmut Giese <hgiese@ratiosoft.com>
wrote:
> Hello out there,
> I have a setup where
> - my app launches the user's browser towards a certain URL
> - where the user is supposed to do something and when
> - he/she returns to my app processing is to continue - based on what
> the user did with the browser.
>
> I thought I could bind on the <Activate> event to get notified when my
> app is "activated" again, but a naive (?) attempt like
> bind . <Activate> {puts "active"}
> didn't result in anything.
>
> Is this feature even implemented? It does exist, of course, on
> Windows, but maybe Tk doesn't make use of it. Or my [bind]ing is wrong
> or I just misunderstood something.
> Any insight in this matter will be greatly appreciated.
> Best regards
> Helmut Giese
I would do:
bind . <FocusIn> {puts "active"; bind . <FocusIn> {}}
--
WK
| |
| Helmut Giese 2006-05-24, 8:06 am |
| On Wed, 24 May 2006 11:12:44 +0200, "Wojciech Kocjan"
<hceijcow.backward@najcok.backward.org> wrote:
>I would do:
>
>bind . <FocusIn> {puts "active"; bind . <FocusIn> {}}
So would I - by now :)
I just came back to answer my own question: Yes, [bind]ing FocusIn on
the toplevel will trigger
- when the whole app gets (re-) activated and
- whenever one of the toplevel's children actually gets the focus -
but that's easily filtered out if it should be a problem.
Thanks and best regards
Helmut Giese
| |
| Andreas Leitgeb 2006-05-24, 10:04 pm |
| Helmut Giese <hgiese@ratiosoft.com> wrote:
> On Wed, 24 May 2006 11:12:44 +0200, "Wojciech Kocjan"
> So would I - by now :)
>
> I just came back to answer my own question: Yes, [bind]ing FocusIn on
> the toplevel will trigger
> - when the whole app gets (re-) activated and
> - whenever one of the toplevel's children actually gets the focus -
> but that's easily filtered out if it should be a problem.
Just for the record:
One way (of many possible ways) to filtering:
bind mytag <FocusIn> {puts "%w received focus"}
bindtags . [concat [bindtags .] mytag]
That way, you get the binding only for the widgets you
want them for (that is: the ones, to whose bindtags you
add your custom tag) but (esp. in the case of toplevels)
not for its children.
Binding to "Toplevel" only works for additional toplevels,
not for "." because "." is usually automatically assigned
a widget-class derived from the script's or execeutable's name.
| |
| Helmut Giese 2006-05-25, 8:14 am |
| On 24 May 2006 18:20:46 GMT, Andreas Leitgeb
<avl@gamma.logic.tuwien.ac.at> wrote:
>Helmut Giese <hgiese@ratiosoft.com> wrote:
>
>Just for the record:
>One way (of many possible ways) to filtering:
> bind mytag <FocusIn> {puts "%w received focus"}
> bindtags . [concat [bindtags .] mytag]
>
>That way, you get the binding only for the widgets you
>want them for (that is: the ones, to whose bindtags you
>add your custom tag) but (esp. in the case of toplevels)
>not for its children.
>
>Binding to "Toplevel" only works for additional toplevels,
>not for "." because "." is usually automatically assigned
>a widget-class derived from the script's or execeutable's name.
Hi Andreas,
thanks for the follow-up.Tells me something new about bindtags.
Best regards
Helmut Giese
| |
| Donal K. Fellows 2006-05-25, 8:14 am |
| Andreas Leitgeb wrote:
> Binding to "Toplevel" only works for additional toplevels,
> not for "." because "." is usually automatically assigned
> a widget-class derived from the script's or execeutable's name.
You can change that using the -class option to wish (or by setting it in
::argv before you do [package require Tk] for the first time in tclsh,
which is effectively equivalent), just as you can set the real name of
the . widget (it does have one, even if you don't normally see it!)
using the -name option.
Donal.
|
|
|
|
|