Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

how to change Tk::Tree data value

by hxdhan (Sexton)
on Jun 15, 2011 at 11:32 UTC ( #909773=perlquestion: print w/ replies, xml ) Need Help??
hxdhan has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I can not find how to change tree data value
$tree->add('1.1',-text=>'aaa',-data=>'aaa');
after add this node, I want to change data value of this node. can you tell me how to do it.

Comment on how to change Tk::Tree data value
Download Code
Re: how to change Tk::Tree data value
by zentara (Archbishop) on Jun 15, 2011 at 12:45 UTC
Re: how to change Tk::Tree data value
by Sandy (Deacon) on Jun 15, 2011 at 14:33 UTC
    If you set your data to an anonymous hash, you can adjust it as required.
    $tree->add('1.1',-text=>'aaa',-data=>{-info=>'aaa'});
    then
    # get data my $d=$tree->infoData('1.1'); # change data $d->{-info}='new data';
    Next time you get the infoData, it will have your new information.

    UPDATE!

    or you can use entryconfigure

    # set entry $tree->add('1.1',-text=>'aaa',-data=>'aaa'); # change data for entry $tree->entryconfigure('1.1',-data=>'new data');

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://909773]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2014-09-21 07:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (167 votes), past polls