Op zaterdag 28 april 2001 19:51, schreef cgavin:
> Hum... I see.
>
> So in your command, you have something like:
>
> bind .top22.mycanvas <Button1> {... %W ...}
>
I do something like this:
$widget(mycanvasalias) bind klickable_lines_tag <Button-1> {...%W...}
> I see a few ways to fix this. One way is to have your -command option call
> a procedure
> that sets the canvas binding.
>
It is a solution (and I realise that in a lot of Tcl/Tk tutorials this way of
coding is recommended ;-), but I hesitate to write proc's for every button,
where the actual command is very simple and short : in those cases I prefer
to keep it in the button-command itself. I even have to admit that I often
have very long and complex button-commands (Why would I write a procedure for
it, since I'm not going to use it elsewhere, and Vtcl shows me the command
nice and clean in one window, the same as if it where a procedure). For me,
this is easier to get an overview ("What does a button do?->look at the
command", and not "->Look at the command to see what procedure gets called,
and then look at that procedure...).
(Feel free to argument against this way of coding, I'm still learning Tcl/Tk,
so don't hesitate to argue with me!)
But maybe my main point against writing my command in a proc.: stictly Tcl/Tk
allows my coding style, so I don't think it would be a good idea when Vtcl
doesn't allow it.
(This reminds me of a question on this list a few weeks ago about destroying
toplevels: maybe in the start-up tips, there should be a list of things you
can do in Tcl/Tk, but aren't allowed to do in Vtcl...)
> One other way is for me to change %W to something else or to allow double %
> like %%W.
>
> I like the %W stuff in -command options because it makes multiple instances
> of windows easier.
>
Agreed.
> Another way is to define binding tags in the bindings editor and to
> enable/disable
> these bindings by using the bindtags command.
>
> CG
>
Agreed, and (as far as I can judge with my limited experience witht Tcl/Tk)
preferred.
Stef.
_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/vtcl-user