Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Tk/Perl Command

by hiseldl (Priest)
on Mar 20, 2003 at 18:02 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-19 12:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found