summaryrefslogtreecommitdiffstats
path: root/library/tk.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-12-03 07:15:02 (GMT)
committerhobbs <hobbs>1999-12-03 07:15:02 (GMT)
commit557bd380adb2d41523c2af7486d2fdcb1fb71363 (patch)
tree0bd124d246eb5ce5e085d5fa5f951576e4beee63 /library/tk.tcl
parentd58480113f888b1a520818358c62893aeae25c6c (diff)
downloadtk-557bd380adb2d41523c2af7486d2fdcb1fb71363.zip
tk-557bd380adb2d41523c2af7486d2fdcb1fb71363.tar.gz
tk-557bd380adb2d41523c2af7486d2fdcb1fb71363.tar.bz2
* library/msgbox.tcl: added color icons for tk_messageBox on Unix
and Mac when tk_strictMotif isn't set. (Hipp) * library/tk.tcl: added window bounds checking to ::tk::PlaceWindow
Diffstat (limited to 'library/tk.tcl')
-rw-r--r--library/tk.tcl24
1 files changed, 19 insertions, 5 deletions
diff --git a/library/tk.tcl b/library/tk.tcl
index e64a98f..dc793e8 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -3,7 +3,7 @@
# Initialization script normally executed in the interpreter for each
# Tk-based application. Arranges class bindings for widgets.
#
-# RCS: @(#) $Id: tk.tcl,v 1.14 1999/11/30 00:02:12 hobbs Exp $
+# RCS: @(#) $Id: tk.tcl,v 1.15 1999/12/03 07:15:02 hobbs Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -45,19 +45,20 @@ namespace eval ::tk {
# Results:
# Returns nothing
#
-proc ::tk::PlaceWindow {w {placement ""} {anchor ""}} {
+proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
wm withdraw $w
update idletasks
- if {[string match p* $placement]} {
+ set checkBounds 1
+ if {[string equal -len [string length $place] $place "pointer"]} {
## place at POINTER (centered if $anchor == center)
- if {[string match "c*" $anchor]} {
+ if {[string equal -len [string length $anchor] $anchor "center"]} {
set x [expr {[winfo pointerx $w]-[winfo reqwidth $w]/2}]
set y [expr {[winfo pointery $w]-[winfo reqheight $w]/2}]
} else {
set x [winfo pointerx $w]
set y [winfo pointery $w]
}
- } elseif {[string match w* $placement] && \
+ } elseif {[string equal -len [string length $place] $place "widget"] && \
[winfo exists $anchor] && [winfo ismapped $anchor]} {
## center about WIDGET $anchor, widget must be mapped
set x [expr {[winfo rootx $anchor] + \
@@ -67,6 +68,19 @@ proc ::tk::PlaceWindow {w {placement ""} {anchor ""}} {
} else {
set x [expr {([winfo screenwidth $w]-[winfo reqwidth $w])/2}]
set y [expr {([winfo screenheight $w]-[winfo reqheight $w])/2}]
+ set checkBounds 0
+ }
+ if {$checkBounds} {
+ if {$x < 0} {
+ set x 0
+ } elseif {$x > ([winfo screenwidth $w]-[winfo reqwidth $w])} {
+ set x [expr {[winfo screenwidth $w]-[winfo reqwidth $w]}]
+ }
+ if {$y < 0} {
+ set y 0
+ } elseif {$y > ([winfo screenheight $w]-[winfo reqheight $w])} {
+ set y [expr {[winfo screenheight $w]-[winfo reqheight $w]}]
+ }
}
wm geometry $w +$x+$y
wm deiconify $w