summaryrefslogtreecommitdiffstats
path: root/library/clrpick.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-11-24 20:59:06 (GMT)
committerhobbs <hobbs>1999-11-24 20:59:06 (GMT)
commit94012d8b33fb70354482798323f2ecb417d7e68b (patch)
treedc708b4fa277d706bc2ccbfdb606642ff7eb615f /library/clrpick.tcl
parent41d379d476d743aa2f72c66183e7acee581f29fe (diff)
downloadtk-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/clrpick.tcl')
-rw-r--r--library/clrpick.tcl32
1 files changed, 5 insertions, 27 deletions
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index 9fa56ff..76c2e99 100644
--- a/library/clrpick.tcl
+++ b/library/clrpick.tcl
@@ -3,7 +3,7 @@
# Color selection dialog for platforms that do not support a
# standard color selection dialog.
#
-# RCS: @(#) $Id: clrpick.tcl,v 1.6 1999/09/02 17:02:52 hobbs Exp $
+# RCS: @(#) $Id: clrpick.tcl,v 1.7 1999/11/24 20:59:06 hobbs Exp $
#
# Copyright (c) 1996 Sun Microsystems, Inc.
#
@@ -65,30 +65,16 @@ proc tkColorDialog {args} {
}
wm transient $w $data(-parent)
-
# 5. 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
+ ::tk::PlaceWindow $w widget $data(-parent)
wm title $w $data(-title)
# 6. 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(okBtn)
+ ::tk::SetFocusGrab $w $data(okBtn)
# 7. Wait for the user to respond, then restore the focus and
# return the index of the selected button. Restore the focus
@@ -97,17 +83,9 @@ proc tkColorDialog {args} {
# restore any grab that was in effect.
tkwait variable tkPriv(selectColor)
- catch {focus $oldFocus}
- grab release $w
- destroy $w
+ ::tk::RestoreFocusGrab $w $data(okBtn)
unset data
- if {[string compare $oldGrab ""]} {
- if {[string equal $grabStatus "global"]} {
- grab -global $oldGrab
- } else {
- grab $oldGrab
- }
- }
+
return $tkPriv(selectColor)
}