Posted to tcl by patthoyts at Fri Sep 22 12:04:47 GMT 2006view raw
- proc balloon::show {mx my} {
- variable balloon_showed
- variable balloon_remove
- variable max_bx
- variable screenwidth
- variable screenheight
- if {[.balloon.text cget -text] == ""} {
- balloon::destroy
- return
- }
- set balloon_showed 1
- set balloon_remove 0
- set b_w [winfo reqwidth .balloon]
- set b_h [winfo reqheight .balloon]
- if {$::tcl_platform(platform) eq "windows"} {
- #tk::PlaceWindow .balloon pointer
- set b_x [expr {$mx + 1}]
- set b_y [expr {$my + 1}]
- } else {
- set b_x [expr {$mx + 12}]
- set b_y [expr {$my + 15}]
- set max_bx [expr {$screenwidth - $b_w}]
- set max_by [expr {$screenheight - $b_h}]
- set b_x [max [min $b_x $max_bx] 0]
- set b_y [max [min $b_y $max_by] 0]
- if {($mx >= $b_x) && ($mx <= $b_x+$b_w)} {
- if {($my >= $b_y) && ($my <= $b_y+$b_h)} {
- set b_y1 [expr {$my - 5 - $b_h}]
- if {$b_y1 >= 0} {
- set b_y $b_y1
- }
- }
- }
- }
- wm geometry .balloon +$b_x+$b_y
- wm deiconify .balloon
- # need the raise in case we're ballooning over a detached menu
- raise .balloon
- }