From patm at visi.com Wed Sep 15 19:51:57 2004 From: patm at visi.com (Patrick McNamee) Date: Wed Sep 15 19:51:59 2004 Subject: [Mpls-pm] [leira@MIT.EDU: Minneapolis Perl Mongers?] Message-ID: <20040916005157.GB6682@isis.visi.com> ----- Forwarded message from "Linda L. Julien" ----- X-Original-To: patm@shell.visi.com Delivered-To: patm@shell.visi.com Delivered-To: patm@visi.com Date: Wed, 15 Sep 2004 19:49:14 -0400 From: "Linda L. Julien" User-Agent: Mozilla Thunderbird 0.7.3 (Macintosh/20040803) X-Accept-Language: en-us, en To: patm@visi.com Subject: Minneapolis Perl Mongers? X-Scanned-By: MIMEDefang 2.42 X-pstn-levels: (S:40.75522/99.90000 R:95.9108 P:95.9108 M:99.2571 C:80.1007 ) X-pstn-settings: 5 (2.0000:8.0000) s gt3 gt2 gt1 r p m C X-pstn-addresses: from [239/10] X-pstn-levels: (S:40.75522/99.90000 R:95.9108 P:95.9108 M:99.2571 C:80.1007 ) X-pstn-settings: 3 (1.0000:2.0000) s gt3 gt2 gt1 r p m C X-pstn-addresses: from [41/2] Hi, I expect to be in Minneapolis a couple of times this Fall, and I'm wondering if there will be any Perl Mongers meetings while I'm there. I'll be there this weekend, but I'll be reserving my FF miles tonight, so unless I hear back pretty much right away, I probably won't be able to change my flight times to accomodate a meeting. I'll also be in town October 6th through 11th, and I haven't purchased my tickets yet, so I could extend the trip on either end if there were a meeting before or after those dates. I know this is somewhat short notice, but if there's any interest, I could do a talk on HTTP::Recorder (a module that records web site interactions and produces WWW::Mechanize scripts) -- Andy Lester, the author of Mech, told me that he'd done a talk for you about WWW::Mechanize, so there might be some interest. If you want more information about HTTP::Recorder, I wrote an article about it for perl.com: http://www.perl.com/pub/a/2004/06/04/recorder.html Let me know if there's a meeting in that time frame. It would be great to meet some of the local perl mongers. Thanks! Linda ----- End forwarded message ----- From JO'Neill at pgicompanies.com Wed Sep 22 13:58:13 2004 From: JO'Neill at pgicompanies.com (Jay O'NEIL) Date: Wed Sep 22 14:00:17 2004 Subject: [Mpls-pm] Issue with binding events to Tk canvas objects. Message-ID: OS = WinXP Dear Experts, I was wondering if someone could help me with this Tk issue. I need to bind events to text objects on a canvas. There are potentially hundreds of these text objects, and would like to do the bind as each one is created in a loop. The problem seems to come when I use a variable for the index number. The top lines of code work as I would expect them to -- when the cursor enters the text object it turns red. If I try to use the second bunch of lines I get a strange result -- all of the objects I try to bind act on the last object only, i.e. when the cursor moves into the object with index 2 or 3 or 4, the object with index 4 turns red. I'm baffled, and I'm probably doing something that is completely wrong. I don't use binding that often, so I might be missing the whole point. # this works as expected $canvas->bind(2,"",sub{&stuff(2);}); $canvas->bind(3,"",sub{&stuff(3);}); $canvas->bind(4,"",sub{&stuff(4);}); # this does not work as expected $foo = 2; $canvas->bind($foo,"",sub{&stuff($foo);}); $foo = 3; $canvas->bind($foo,"",sub{&stuff($foo);}); $foo = 4; $canvas->bind($foo,"",sub{&stuff($foo);}); # this is the only object that gets acted upon sub stuff { my $index = shift; $canvas->itemconfigure($index,-fill=>'red'); } If someone could point me in the right direction I would really appreciate it. Jay O'Neill jayzenx@earthlink.net From matt at omega.org Thu Sep 23 12:44:58 2004 From: matt at omega.org (Matthew Johnson) Date: Thu Sep 23 12:45:11 2004 Subject: [Mpls-pm] Issue with binding events to Tk canvas objects. In-Reply-To: References: Message-ID: <498F1F56-0D88-11D9-AECD-000A95D92230@omega.org> On Sep 22, 2004, at 1:58 PM, Jay O'NEIL wrote: > OS = WinXP > > Dear Experts, > > I was wondering if someone could help me with this Tk issue. I need to > bind events > to text objects on a canvas. There are potentially hundreds of these > text [clip clip] Hi Jay: I guess we don't have many Tk experts here. Maybe the OO experts here can answer your question. Do you think the problem is with the bind method? -- Matthew Johnson Custom Software Consultant Minneapolis, MN +1 612 435-2250 matt@omega.org From ian at indecorous.com Thu Sep 23 14:09:39 2004 From: ian at indecorous.com (Ian Malpass) Date: Thu Sep 23 14:09:43 2004 Subject: [Mpls-pm] Issue with binding events to Tk canvas objects. In-Reply-To: References: Message-ID: On Wed, 22 Sep 2004, Jay O'NEIL wrote: > # this works as expected > $canvas->bind(2,"",sub{&stuff(2);}); > $canvas->bind(3,"",sub{&stuff(3);}); > $canvas->bind(4,"",sub{&stuff(4);}); > > # this does not work as expected > $foo = 2; > $canvas->bind($foo,"",sub{&stuff($foo);}); > $foo = 3; > $canvas->bind($foo,"",sub{&stuff($foo);}); > $foo = 4; > $canvas->bind($foo,"",sub{&stuff($foo);}); > # this is the only object that gets acted upon Isn't it some sort of closure-related problem? You end up with a reference to $foo in &stuff, and its final value is 4, so all your callbacks call &stuff(4). Or something. Maybe something like: for my $foo ( 2..4 ) { $canvas->bind($foo,"",&stuff($foo);); } sub stuff { my $index = shift; return sub { $canvas->itemconfigure($index,-fill=>'red'); }; } I know nothing about Tk (and, for that matter, precious little about closures) and I haven't actually *tested* the above. Ian - --------------------------------------------------------------------------- The soul would have no rainbows if the eyes held no tears. Ian Malpass From taj at jdmz.net Thu Sep 23 16:29:04 2004 From: taj at jdmz.net (Troy Johnson) Date: Thu Sep 23 16:29:08 2004 Subject: [Mpls-pm] 2 forwarded messages... Message-ID: Perl Mongers, Sorry I sent the attached emails from an unsubscribed address. Fixed that and here they are, Troy -------------- next part -------------- Skipped content of type multipart/digest