Try the following short 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') 
;                
        }
}

On 8/3/05, Doug Loud <[EMAIL PROTECTED]> wrote:
> 
> Speaking of grid controls, is there a browser usable one?  Does the CGI
> module have one or does one have to use a java applet?
> 
> 
> 
> 
> Douglass N. Loud
> President
> Integrated Information Systems, Inc.
> 292 Fifth Avenue
> New York, NY 10001
> 212-714-3522 (office)
> 203-952-7108 (cell)
> [EMAIL PROTECTED]
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Octavian Rasnita
> Sent: Wednesday, August 03, 2005 8:50 AM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: Creating a grid control
> 
> Hi,
> 
> Does anyone know if it is possible to create a grid control which is
> accessible using the keyboard only (no mouse)?
> I have tried a few examples from the Win32::GUI::Grid package, but I could
> select a cell only by using the mouse, but I would like to have a grid in
> which I can navigate using the arrow keys in order to select the rows.
> 
> Is this possible with Win32::GUI?
> 
> Thank you.
> 
> Teddy
> 
> _______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> _______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

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

Reply via email to