You need to pass argument to the display function, try the following: my $button1 = $mw->Button(-text => 'button#1',-command => [\&display, ARG_PASSING_TO_DISPALY])
--Kfir -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Monday, February 23, 2009 10:59 PM To: [email protected] Subject: A Perl::Tk question Hi there, I need to know the name of the object that called me from inside my callback routine. For instance I have 3 buttons, they all call the same subroutine, if button number 3 was pressed, I want to be able to determine that at run time. Even if it's just by reading the button text. How do I do this? ( small example snippet ) my $button1 = $mw->Button(-text => 'button#1',-command => \&display) my $button2 = $mw->Button(-text => 'button#2',-command => \&display) my $button3 = $mw->Button(-text => 'button#3',-command => \&display) sub display { print "I was called by button ???\n"; } This is probably some simple thing that I am not finding at the moment. I've tried googling this all over the place and can't seem to make any headway. Thanks in advance Alex The information transmitted is intended only for the addressee and may contain confidential, proprietary and/or privileged material. Any unauthorized review, distribution or other use of or the taking of any action in reliance upon this information is prohibited. If you receive this in error, please contact the sender and delete or destroy this message and any copies. _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
