Changeset 772
- Timestamp:
- Dec 4, 2009 5:11:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsascmds.tcl
- Property rcs:date changed from 2003/11/13 17:21:17 to 2004/01/30 00:41:47
- Property rcs:lines changed from +75 -60 to +26 -19
- Property rcs:rev changed from 1.53 to 1.54
r749 r772 341 341 } 342 342 343 proc putontop {w } {343 proc putontop {w "center 0"} { 344 344 # center window $w above its parent and make it stay on top 345 345 set wp [winfo parent $w] … … 347 347 wm withdraw $w 348 348 update idletasks 349 # center the new window in the middle of the parent 350 set x [expr [winfo x $wp] + [winfo width $wp]/2 - \ 351 [winfo reqwidth $w]/2 - [winfo vrootx $wp]] 352 if {$x < 0} {set x 0} 353 set xborder 10 354 if {$x+[winfo reqwidth $w] +$xborder > [winfo screenwidth $w]} { 355 incr x [expr \ 356 [winfo screenwidth $w] - ($x+[winfo reqwidth $w] + $xborder)] 357 } 358 set y [expr [winfo y $wp] + [winfo height $wp]/2 - \ 359 [winfo reqheight $w]/2 - [winfo vrooty $wp]] 360 if {$y < 0} {set y 0} 361 set yborder 25 362 if {$y+[winfo reqheight $w] +$yborder > [winfo screenheight $w]} { 363 incr y [expr \ 364 [winfo screenheight $w] - ($y+[winfo reqheight $w] + $yborder)] 365 } 366 wm geom $w +$x+$y 349 if {$center} { 350 set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \ 351 - [winfo vrootx [winfo parent $w]]}] 352 set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \ 353 - [winfo vrooty [winfo parent $w]]}] 354 } else { 355 # center the new window in the middle of the parent 356 set x [expr [winfo x $wp] + [winfo width $wp]/2 - \ 357 [winfo reqwidth $w]/2 - [winfo vrootx $wp]] 358 if {$x < 0} {set x 0} 359 set xborder 10 360 if {$x+[winfo reqwidth $w] +$xborder > [winfo screenwidth $w]} { 361 incr x [expr [winfo screenwidth $w] - \ 362 ($x+[winfo reqwidth $w] + $xborder)] 363 } 364 set y [expr [winfo y $wp] + [winfo height $wp]/2 - \ 365 [winfo reqheight $w]/2 - [winfo vrooty $wp]] 366 if {$y < 0} {set y 0} 367 set yborder 25 368 if {$y+[winfo reqheight $w] +$yborder > [winfo screenheight $w]} { 369 incr y [expr [winfo screenheight $w] - \ 370 ($y+[winfo reqheight $w] + $yborder)] 371 } 372 } 373 wm geometry $w +$x+$y 367 374 wm deiconify $w 368 375
Note: See TracChangeset
for help on using the changeset viewer.