Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Tk tagBind problem

by {NULE} (Hermit)
on Jan 18, 2003 at 18:35 UTC ( [id://228018]=note: print w/replies, xml ) Need Help??


in reply to Re: Tk tagBind problem
in thread Tk tagBind problem

It has to do with that thing that I have a hard time describing in my post (see below yours). Since these callbacks are generated within a callback, I don't believe the anonymous subs are eval'ed until the dbclick callback is complete. Since the $fullpath is global to the sub all three callbacks end up with the same value for $fullpath when they are created.

This is why I think using anonymous subs for callbacks is a bad thing - especially when created dynamically like this. Too much potential for action at a distance. I prefer the nice, predictable method of passing an anonymous array to the callback mechanism and letting Tk deal with that. Besides, the fact that the callback then passes the parent widget's ref to the subroutine with this method is immensly useful sometimes. (For example using dynamic callbacks with multiple canvas methods, each of which could use the same callback sub and potential share the same tag name.)

{NULE}
--
http://www.nule.org

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://228018]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found