Sorry, the end was truncated.  Here's the whole program
#---------------
use strict ;
use Tk ;
my $mw = MainWindow -> new() ;
my $logw = $mw -> Scrolled('ROText') -> pack ;
my %cell ;
for my $col (0 ..3){
        for my $row (0 .. 5){
                $cell{$col}{$row} = $logw -> Label(     -text => "*$col $row*" ,
                                                                        
-background => 'white' ,
                                                        ) -> grid( -column => 
$col, -row => $row) ;             
        }       
}
my $hold_col = 0;
my $hold_row = 0 ;
$cell{$hold_col}{$hold_row} -> configure(-background => 'red') ;

$mw  -> bind('<KeyPress>' => =>  [\&keywork,$logw ] )  ;



MainLoop ;


sub keywork{
        my ($widget) = @_ ;             
        my $e = $widget->XEvent ;               
        my ($keysym_text, $keysym_decimal, $mousewheelD) = ($e->K, $e-> N,
$e->D );        # final magic
        print " you pressed $keysym_text ,  $keysym_decimal,  $mousewheelD " ;
        if( $keysym_text eq 'Down'){
                if( $hold_row == 5 ) {
                        return
                } ;
                $cell{$hold_col}{$hold_row} -> configure( -background => 
'white') ;
                $hold_row ++ ;
                $cell{$hold_col}{$hold_row} -> configure(-background => 'red') 
;                
        }
        if( $keysym_text eq 'Up' ){
                if( $hold_row == 0 ) {
                        return
                } ;
                $cell{$hold_col}{$hold_row} -> configure( -background => 
'white') ;
                $hold_row -- ;
                $cell{$hold_col}{$hold_row} -> configure(-background => 'red') 
;                
        }
}

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to