Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Binding Perl tk table scrollbars with keyboards up and down arrow keys

by zentara (Archbishop)
on Dec 18, 2018 at 12:52 UTC ( [id://1227391]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Binding Perl tk table scrollbars with keyboards up and down arrow keys
in thread Binding Perl tk table scrollbars with keyboards up and down arrow keys

Hi, see Need help finding which column/row the mouse cursor is over in Tk.... You might be able to get your current scrollbar position, then use $scrollbar->set(first, last); to adjust your new range. You may even be able to juggle the code in the -scrollcommand option, and use the -fixedrows and or -fixedcolumns options to select your range. Here is something that you could look at to start your mind working.
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Table; my $mw= tkinit; #$mw->geometry("400x400+100+100"); my $table = $mw->Scrolled('Table', -rows =>2, -columns => 100, -fixedrows => 2, #trick to hide scrollbars -fixedcolumns => 5, -scrollbars => 'soe', -takefocus => 1,)->pack(-fill=>'both', -expand=>1); my %widgets; for my $row(1..10){ for my $col(1..100){ $widgets{$row}{$col} = $table->Button( -text=> "$row - $col", -background => 'white', -command => sub{ do_me($row,$col) } ); $table->put( $row,$col,$widgets{$row}{$col} ); } } MainLoop; sub do_me{ my ($row, $col) = @_; print "$row $col\n"; }

I'm not really a human, but I play one on earth. ..... an animated JAPH
  • Comment on Re^3: Binding Perl tk table scrollbars with keyboards up and down arrow keys
  • Download Code

Replies are listed 'Best First'.
Re^4: Binding Perl tk table scrollbars with keyboards up and down arrow keys
by Anonymous Monk on Dec 19, 2018 at 06:32 UTC

    Thanks, this surely going to help. Let me revert on this. I really appreciate your help on this portal especially on Perl tk. Thanks again :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1227391]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-24 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found