I am working on linux based gui-tool.
I have the code below. (tcl script)
proc Kuser {} {
echo "AAA"
}
proc getxy_of_mouse_pointer {} {
gui_mouse_tool -window Layout.1 -start POINT_DEFINITION_TOOL
bind . <Button-1> [kuser]
echo "Hello"
}
"gui_mosue_tool" is a built in proc of the tool.
When executing proc as shown below in the tool,
"Hello" is output immediately without waiting for Button-1
tool > getxy_of_mouse_pointer
AAA
Hello
I want to run Kuser-proc when right mouse button is clicked
I think the bind~ part needs to be modified.
But I don't know what to do.
bind, event, add etc...
The [Kuser]
argument to your bind
is a script substitution - it says: "run this script and replace the [...]
with the script's result". So, after the arguments for the bind
command are resolved, the bind command that gets run is:
bind . <Button-1> {}
(presuming that the echo
command returns nothing, and therefore Kuser
).
You want to give the bind
command the name of the command to run when the event happens, not the result of running that command:
bind . <Button-1> Kuser