# poToolhelp.tcl # Simple package to implement a toolhelp widget. # Paul Obermeier, 2001. package provide poToolhelp 1.0 namespace eval ::poToolhelp { namespace export AddBinding namespace export Init variable topWidget } proc ::poToolhelp::Init { w { bgColor lightyellow } { fgColor black } } { variable topWidget # Create Toolbar help window with a simple label in it. if { [winfo exists $w] } { destroy $w } toplevel $w set topWidget $w label $w.l -text "This is toolhelp" -bg $bgColor -fg $fgColor -relief ridge pack $w.l wm overrideredirect $w true wm geometry $w [format "+%d+%d" -100 -100] } proc ::poToolhelp::ShowToolhelp { x y str } { variable topWidget $topWidget.l configure -text $str raise $topWidget wm geometry $topWidget [format "+%d+%d" $x [expr $y +10]] } proc ::poToolhelp::HideToolhelp {} { variable topWidget wm geometry $topWidget [format "+%d+%d" -100 -100] } proc ::poToolhelp::AddBinding { w str } { variable topWidget if { ![info exists topWidget]} { Init .poToolhelp } bind $w "::poToolhelp::ShowToolhelp %X %Y [list $str]" bind $w "::poToolhelp::HideToolhelp" bind $w