Menu

#1681 Grabs get confused with multiple interpreters

open
56. [grab] (17)
5
2006-01-20
2004-03-24
No

I'm not sure if this is the right category, or even if
I'm doing something I'm not supposed to, but I got some
very strange behaviour which I'd better report...

If you have Tk running in two interpreters, and one of
them executes a grab command, then if the other tries
to do so as well an error dialogue is produced that
cannot be killed. Here's a simple example:

[jaspert@spirograph jaspert]$ /usr/local/ActiveTcl/bin/wish
% info patchlevel
8.4.6
% set foo [interp create]
interp0
% $foo eval package require Tk
8.4
% pack [button .b -text Test -command tk_getOpenFile]
% # Clicking button results in file dialogue
% $foo eval grab .
% bgerror failed to handle background error.
Original error: grab failed: another application
has grab
Error in bgerror: grab failed: another application
has grab

The above is produced when ckicking the Test button,
followed by OK or Cancel in the file dialogue. At this
stage an Application Error dialogue is also produced,
which expands when the Show Details button is hit, but
cannot be removed. That dialogue has this text:

grab failed: another application has grab
grab failed: another application has grab
while executing
"grab $oldGrab"
(procedure "::tk::RestoreFocusGrab" line 21)
invoked from within
"::tk::RestoreFocusGrab $w $data(ent) withdraw"
(procedure "::tk::dialog::file::" line 94)
invoked from within
"::tk::dialog::file:: save -title {Select Log File}
-filetypes {{{Log Files} .log} {{Text Files} .txt}
{{All Files} *}} -defaultextension .log -parent ..."
("eval" body line 1)
invoked from within
"eval ::tk::dialog::file:: save $args"
(procedure "tk_getSaveFile" line 5)
invoked from within
"tk_getSaveFile -title [mc "Select Log File"]
-filetypes $types -defaultextension .log -parent
.bgerrorDialog"
(procedure "SaveToLog" line 8)
invoked from within
"SaveToLog {grab failed: another application has grab
grab failed: another application has grab
while executing
"grab $oldGrab"
(procedure "::t..."
(in namespace inscope "::tk::dialog::error" script
line 1)
invoked from within
"::namespace inscope ::tk::dialog::error SaveToLog
{grab failed: another application has grab
grab failed: another application has grab
while execu..."
invoked from within
".bgerrorDialog.function invoke"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list $w invoke]"
(procedure "tk::ButtonUp" line 22)
invoked from within
"tk::ButtonUp .bgerrorDialog.function"
(command bound to event)

I'm not sure what ought to happen; either the grab
should apply to both interpreters, which I'd prefer, or
they should be independent of one another like
different processes.

Discussion

  • Anonymous

    Anonymous - 2004-03-24

    Logged In: YES
    user_id=456242

    After a bit more fiddling, it seems one very simple
    manifestation of the problem is that if you execute a grab
    in one interpreter, then execute grab current in another,
    the name of the grabbed widget from the first interpreter is
    returned.

     
  • Joe English

    Joe English - 2006-01-20

    Logged In: YES
    user_id=68433

    (From discussions with Schelte Bron on the tcl'ers chat):

     
  • Joe English

    Joe English - 2006-01-20
    • assigned_to: hobbs --> jenglish
     
MongoDB Logo MongoDB