Is there anybody that can help me ?
Thank you very much!
>
> When I use following option of the TK::Tree:
> ------------------------------
> Name: browseCmd
> Class: BrowseCmd
> Switch: -browsecmd
> Specifies a callback to call whenever the user browses on an entry (usually by
>single-clicking on the entry). The callback is called with one argument, the pathname
>of the entry.
> --------------------------
>
> Following is my code.
> .....
>
> $r_tv->configure( -opencmd => sub { open_node( $$r_tv,$$r_tb,@_ ); } ,
> -command => sub { command_act($$r_tv,@_);},
> -browsecmd => sub {view_attr($tf2,$$r_tb,@_);}
> );
>
> ....
> sub view_attr {
> my ($tb,$address) = @_;
> my $node = $tb->address($address);
> my %attrs = $node->all_external_attr();
> if ($node->tag eq '~text') {
> .....
> }
> else {
> my ($key,$val);
> while (($key,$val) = each (%attrs)) {
> print "$key : $val\n";
> }
> }
> }
>
> I found that everytime when I clicked the node on the Tree widget, the view_attr
>subroutine was invoked twice, the "$key : $val\n" were printed twice.
> Why ????
> If I just want to invoke the view_attr subroutine only once (especially there is a
>complex work in this subroutine) when I click the tree node, how can I implement
>this?
>
>
> Thanks in advance!
>
>