Changeset 413 for trunk/gui/scripts/tooltip.tcl
- Timestamp:
- Apr 26, 2006 6:42:46 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/tooltip.tcl
r213 r413 59 59 bind RapptureTooltip <KeyPress> \ 60 60 [list ::Rappture::Tooltip::tooltip cancel] 61 62 private common icons63 set dir [file dirname [info script]]64 set icons(cue) [image create photo -file [file join $dir images cue24.gif]]65 61 } 66 62 … … 141 137 142 138 # strings can't be too big, or they'll go off screen! 143 if {[string length $mesg] > 1000} {144 set mesg "[string range $mesg 0 1000]..."145 }146 139 set pos 0 147 140 ::for {set i 0} {$pos >= 0 && $i < 20} {incr i} { … … 152 145 set mesg "[string range $mesg 0 $pos]..." 153 146 } 147 if {[string length $mesg] > 1000} { 148 set mesg "[string range $mesg 0 1500]..." 149 } 154 150 $itk_component(text) configure -text $mesg 155 151 156 152 # 157 # Make sure the tooltip doesn't go off screen. Then, put it up.153 # Make sure the tooltip doesn't go off screen. 158 154 # 159 155 update idletasks … … 182 178 } 183 179 180 # 181 # Will the tooltip pop up under the mouse pointer? If so, then 182 # it will just disappear. Doh! We should figure out a better 183 # place to pop it up. 184 # 185 set px [winfo pointerx $hull] 186 set py [winfo pointery $hull] 187 if {$px >= $xpos && $px <= $xpos+[winfo reqwidth $hull] 188 && $py >= $ypos && $py <= $ypos+[winfo reqheight $hull]} { 189 190 if {$px > [winfo screenwidth $hull]/2} { 191 set signx "-" 192 set xpos [expr {[winfo screenwidth $hull]-$px+4}] 193 } else { 194 set signx "+" 195 set xpos [expr {$px+4}] 196 } 197 if {$py > [winfo screenheight $hull]/2} { 198 set signy "-" 199 set ypos [expr {[winfo screenheight $hull]-$py+4}] 200 } else { 201 set signy "+" 202 set ypos [expr {$py+4}] 203 } 204 } 205 206 # 207 # Finally, put it up. 208 # 184 209 wm geometry $hull $signx$xpos$signy$ypos 185 210 update … … 276 301 error "wrong # args: should be \"tooltip pending widget ?@x,y?\"" 277 302 } 278 set widget[lindex $args 0]303 set tag [lindex $args 0] 279 304 set loc [lindex $args 1] 280 305 281 if {[winfo exists $widget]} { 282 .rappturetooltip configure -message $catalog($widget) 306 # tag name may be .g-axis -- get widget ".g" part 307 set widget $tag 308 if {[regexp {^(\.[^-]+)-[^\.]+$} $widget match wname]} { 309 set widget $wname 310 } 311 312 if {[winfo exists $widget] && [info exists catalog($tag)]} { 313 .rappturetooltip configure -message $catalog($tag) 283 314 if {[string index $loc 0] == "@"} { 284 315 .rappturetooltip show $loc … … 381 412 # create a tooltip widget to show error cues 382 413 Rappture::Tooltip .rappturetoolcue \ 383 -icon $Rappture::Tooltip::icons(cue)\414 -icon [Rappture::icon cue24] \ 384 415 -background black -outline #333333 -foreground white 385 416
Note: See TracChangeset
for help on using the changeset viewer.