Hi

I have a problem with TK.

    for (my $i = 0; exists $transactions{$account}[$i]; $i++) {
        next if $transactions{$account}[$i]{'type'} < 0;    #do not display
this
        .
        .
        .
        $frames{'data-r'}->insert('end', $line, ["T$i", $colortag]);
        print "debug: $i\n";
A        $frames{'data-r'}->tag( 'bind', "T$i", '<1>'         => sub {
&selectTransaction($i); } );
B        $frames{'data-r'}->tag( 'bind', "T$i", '<Delete>'    => sub {
&deleteTransaction($i); } );
C        $frames{'data-r'}->tag( 'bind', "T$i", '<Control-p>' => sub {
&addforPrinting($i);    } ) if $type == 0;
        push @selections, $i;
    }

Why is it that the function calls selectTransaction, deleteTransactions and
addforPrinting (Lines A,B,C)
always receive only one value which is the last value of $i even if the
print line would enumerate all the values.


This piece of code however works:
    foreach my $i (sort {$accounts{$a}{'name'} cmp $accounts{$b}{'name'}}
keys %accounts) {
        $frames{'name-r'}->insert('end', "\n") if $flag;
        $line = sprintf "%-50s
%10s",$accounts{$i}{'name'},$accounts{$i}{'VAT'};
        $frames{'name-r'}->insert('end', $line, "A$i");
X        $frames{'name-r'}->tag( 'bind', "A$i", '<1>'         => sub {
&selectAccount($i) } );
Y        $frames{'name-r'}->tag( 'bind', "A$i", '<Double-1>'  => sub {
&markAccount($i) } );
        $flag++;
    }
In this code, selectAccount($i) and markAccount($i) (Lines X,Y) receives the
paramater properly.

Why is the 1st code not working, while the second one works?

Need help.
Im at my wits end figuring this out.

Dan
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to