Menu

#904 Clicking application windows fails to raise dialogs when a g

obsolete: 8.3
closed-fixed
5
2004-09-10
2000-11-01
No

OriginalBugID: 5040 RFE
Version: 8.3
SubmitDate: '2000-04-12'
LastModified: '2000-09-06'
Severity: MED
Status: UnAssn
Submitter: shawn
ChangedBy: hobbs
RelatedBugIDs: 4609
OS: Windows NT

When a dialog has a local grab and the window is hidden clicking in other toplevel windows doesn't raise the dialog. I understand that this is that this is by design - as I understand it from reading the help. It would be nice however if a mouse event(click - I am thinking - possibly enter) in other parts of the application would raise the application.

to reproduce:

Run tkerror at the command line in an interactive shell - Hide the popup dialog. Click on the main window for the application - nothing happens.

I expect the dialog to raise.

Discussion

  • Don Porter

    Don Porter - 2001-03-22
    • labels: 104348 --> 68. Win Window Operations
     
  • Don Porter

    Don Porter - 2003-11-12
    • summary: Clicking application windows fails to raise dialogs when a grab is active --> Clicking application windows fails to raise dialogs when a g
    • assigned_to: nobody --> vincentdarley
     
  • Vince Darley

    Vince Darley - 2003-11-13
    • assigned_to: vincentdarley --> hobbs
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2004-09-10
    • status: open --> closed-invalid
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2004-09-10

    Logged In: YES
    user_id=72656

    If you want have outside windows respond when you 'grab' a
    window, you need something like this:

    proc grabwatch {w X Y} {
    set in [winfo containing $X $Y]
    puts "Received <1> in '$in' by $w"
    if {![string match $w* $in]} {
    # $in may be "" if we hit a titlebar
    if {![winfo exists $in]} { set in $w }
    # outside grab hierarchy - raise the window, which will
    # bring our grab window with it
    raise [winfo toplevel $in]
    # then force focus into the grabbing window
    focus -force $w
    }
    }

    and in your code:

    bind [winfo toplevel $widget] <1> [list grabwatch %W %X %Y]
    grab $widget
    # wait till your grab is done somehow
    bind [winfo toplevel $widget] <1> {}

    This works because during a grab, all mouse events go to the
    grabbing widget.

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2004-09-10

    Logged In: YES
    user_id=72656

    It turns out that this is better handled as a default Tk
    behavior, and can be done by forcing SetFocus on the grab
    window when it exists, instead of just ignoring SetFocus if
    the current window was grab excluded (in
    tkWinWm.c:ActivateWindow). Corrected for 8.4.8 and 8.5.

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2004-09-10
    • status: closed-invalid --> closed-fixed