public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Mo DeJong <mdejong@cygnus.com>
To: insight@sourceware.cygnus.com
Subject: Re: comment in managedwin.itb
Date: Tue, 28 Nov 2000 12:54:00 -0000	[thread overview]
Message-ID: <Pine.SOL.3.91.1001128124857.26391B-100000@cse.cygnus.com> (raw)
In-Reply-To: <87pujf95nc.fsf@creche.cygnus.com>

On 28 Nov 2000, Tom Tromey wrote:

> I see this code in managedwin.itb:
> 
>   # I don't understand this next line and no one commented it, so it's gone.
>   #focus -force [focus -lastfor $top]
>   
>   focus $top

If you are looking for a better way to do that, you
could use this proc. It does the refocus management
with a -force except that it also handles the case
where the focus has not yet been assigned to a
widget in the given toplevel.

proc _refocus { window } {
    set toplevel [winfo toplevel $window]
    set last [focus -lastfor $window]
    if {$toplevel == $last} {
        focus -force $window
    } else {
        focus -force $last
    }
}

Just call it like so:

_refocus $text

Of course, I am assuming that you want to actually snap
the focus to the given widget with -force here.

Mo DeJong
Red Hat Inc

  reply	other threads:[~2000-11-28 12:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-28 12:47 Tom Tromey
2000-11-28 12:54 ` Mo DeJong [this message]
2000-11-28 13:00 ` Syd Polk
2000-11-28 13:08   ` Keith Seitz
2000-11-28 13:16     ` Fernando Nasser
2000-11-28 20:17   ` Tom Tromey
2000-11-29  9:40     ` Fernando Nasser
2000-12-07 14:18       ` Fernando Nasser
2000-12-07 14:40         ` Tom Tromey
2000-12-07 15:15           ` Fernando Nasser
     [not found] <975459464.28425.ezmlm@sources.redhat.com>
2000-11-28 19:19 ` Jim Ingham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.SOL.3.91.1001128124857.26391B-100000@cse.cygnus.com \
    --to=mdejong@cygnus.com \
    --cc=insight@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).