At 06:42 PM 09/25/00 +0200, you wrote:
>**The vtcl-toolbar shows a yellow 'help' text when my mouse is over a button.
>Can I use this feature easily in my own applications?
>
I use the following tcl/tk code. I forget where I got it from.
Include the code below (between the 2 lines) and then in your
main proc, do this:
init_balloon
set_balloon path1 {Balloon help for path 1}
set_balloon path2 {Balloon help for path 2}
....
For example: (you can run the below as a test, hover
over label 1 or label 2 and see the balloon help pop up.
proc main {} {
toplevel .xxx
label .xxx.l1 -text "label 1"
pack .xxx.l1
label .xxx.l2 -text "label 2"
pack .xxx.l2
init_balloon
set_balloon .xxx.l1 {Balloon help for label 1}
set_balloon .xxx.l2 {Balloon help for lab 2}
}
#----------------------------------------------------------
proc {balloon} {target message {cx 0} {cy 0}} {
global Bulle
if {$Bulle(first) == 1 } {
set Bulle(first) 2
if { $cx == 0 && $cy == 0 } {
set x [expr [winfo rootx $target] + ([winfo width $target]/2)]
set y [expr [winfo rooty $target] + [winfo height $target] + 4]
} else {
set x [expr $cx + 4]
set y [expr $cy + 4]
}
toplevel .balloon -bg black
wm overrideredirect .balloon 1
label .balloon.l -text $message -relief flat -bg #ffffaa -fg
black -padx 2 -pady 0 -anchor w
pack .balloon.l -side left -padx 1 -pady 1
wm geometry .balloon +${x}+${y}
set Bulle(set) 1
}
}
proc {kill_balloon} {} {
global Bulle
after cancel $Bulle(id)
if {[winfo exists .balloon] == 1} {
destroy .balloon
}
set Bulle(set) 0
}
proc {set_balloon} {target message} {
global Bulle
set Bulle($target) $message
bindtags $target "[bindtags $target] Bulle"
}
proc init_balloon {} {
bind Bulle <Enter> {
set Bulle(set) 0
set Bulle(first) 1
set Bulle(id) [after 500 {balloon %W $Bulle(%W) %X %Y}]
}
bind Bulle <Button> {
set Bulle(first) 0
kill_balloon
}
bind Bulle <Leave> {
set Bulle(first) 0
kill_balloon
}
bind Bulle <Motion> {
if {$Bulle(set) == 0} {
after cancel $Bulle(id)
set Bulle(id) [after 1000 {balloon %W $Bulle(%W) %X %Y}]
}
}
}
#-----------------------------------------------------------------------
main
_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/vtcl-user