diff options
author | hobbs <hobbs> | 1999-11-24 20:59:06 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 1999-11-24 20:59:06 (GMT) |
commit | 94012d8b33fb70354482798323f2ecb417d7e68b (patch) | |
tree | dc708b4fa277d706bc2ccbfdb606642ff7eb615f /library/xmfbox.tcl | |
parent | 41d379d476d743aa2f72c66183e7acee581f29fe (diff) | |
download | tk-94012d8b33fb70354482798323f2ecb417d7e68b.zip tk-94012d8b33fb70354482798323f2ecb417d7e68b.tar.gz tk-94012d8b33fb70354482798323f2ecb417d7e68b.tar.bz2 |
* library/clrpick.tcl:
* library/msgbox.tcl:
* library/tk.tcl:
* library/tkfbox.tcl:
* library/xmfbox.tcl: fixed dialogs to center over -parent,
added utility functions ::tk::PlaceWindow, ::tk::SetFocusGrab,
::tk::RestoreFocusGrab to tk.tcl to help
Diffstat (limited to 'library/xmfbox.tcl')
-rw-r--r-- | library/xmfbox.tcl | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl index 30932b2..02e18f1 100644 --- a/library/xmfbox.tcl +++ b/library/xmfbox.tcl @@ -4,7 +4,7 @@ # Unix platform. This implementation is used only if the # "tk_strictMotif" flag is set. # -# RCS: @(#) $Id: xmfbox.tcl,v 1.8 1999/09/02 17:02:53 hobbs Exp $ +# RCS: @(#) $Id: xmfbox.tcl,v 1.9 1999/11/24 20:59:06 hobbs Exp $ # # Copyright (c) 1996 Sun Microsystems, Inc. # @@ -35,15 +35,8 @@ proc tkMotifFDialog {type args} { # Set a grab and claim the focus too. - set oldFocus [focus] - set oldGrab [grab current $w] - if {[string compare $oldGrab ""]} { - set grabStatus [grab status $oldGrab] - } - grab $w - focus $data(sEnt) - $data(sEnt) select from 0 - $data(sEnt) select to end + ::tk::SetFocusGrab $w $data(sEnt) + $data(sEnt) selection range 0 end # Wait for the user to respond, then restore the focus and # return the index of the selected button. Restore the focus @@ -52,16 +45,8 @@ proc tkMotifFDialog {type args} { # restore any grab that was in effect. tkwait variable tkPriv(selectFilePath) - catch {focus $oldFocus} - grab release $w - wm withdraw $w - if {[string compare $oldGrab ""]} { - if {[string equal $grabStatus "global"]} { - grab -global $oldGrab - } else { - grab $oldGrab - } - } + ::tk::RestoreFocusGrab $w $data(sEnt) withdraw + return $tkPriv(selectFilePath) } @@ -119,16 +104,9 @@ proc tkMotifFDialog_Create {dataName type argList} { # Withdraw the window, then update all the geometry information # so we know how big it wants to be, then center the window in the - # display and de-iconify it. - - wm withdraw $w - update idletasks - set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \ - - [winfo vrootx [winfo parent $w]]}] - set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \ - - [winfo vrooty [winfo parent $w]]}] - wm geom $w +$x+$y - wm deiconify $w + # display (Motif style) and de-iconify it. + + ::tk::PlaceWindow $w wm title $w $data(-title) return $w |