Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Tk/Perl Command

by hiseldl (Priest)
on Mar 20, 2003 at 18:02 UTC ( #244668=note: print w/replies, xml ) Need Help??


in reply to Tk/Perl Command

Try passing your array as a ref to your sub:

my @info; my $button_submit = $lf->Button( -text => 'Search', -command => [\&get_data, \@info], )->pack(qw//);
...this should pass the \@info ref into your get_data sub. You can also add your Tk widget as another parameter and call configure on that ref.
my @info; my $button_submit = $lf->Button( -text => 'Search', -command => [\&get_data, \@info, $TkWidget], )->pack(qw//); ... sub get_data { my ($info_ref, $tkwidget_ref) = @_; # add/delete/modify elements of $info_ref # call configure on the widget $tkwidget_ref->configure(...); }

This is the method I use when I want to modify a data structure using a callback.

--
hiseldl
What time is it? It's Camel Time!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2022-05-22 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (78 votes). Check out past polls.

    Notices?