Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Perl Tk : show list box items in grid style

by selva (Scribe)
on May 19, 2010 at 13:51 UTC ( #840707=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl Tk : show list box items in grid style
in thread Perl Tk : show list box items in grid style

In Tk::Table and Tk::TableMatrix there is no click event. My Requirement is If i click any row it should affect other list box.

I tried with Tk::MListbox module. But here height option is not working.


Comment on Re^2: Perl Tk : show list box items in grid style
Re^3: Perl Tk : show list box items in grid style
by stefbv (Chaplain) on May 19, 2010 at 17:09 UTC
    In Tk::Table and Tk::TableMatrix there is no click event.

    Example of Tk::TableMatrix in "list mode". The user can click a row and the program responds with a message in the console."

    use strict; use warnings; use Tk; use Tk::TableMatrix; my $main = MainWindow->new; $main->title("TM - in list mode"); my $xtvar; foreach my $row (0 .. 7){ foreach my $col (0 .. 2){ if ($col == 0) { $xtvar->{"$row,$col"} = "click row $row"; } else { $xtvar->{"$row,$col"} = "r$row, c$col"; } } } my $xtable = $main->Scrolled( 'TableMatrix', -rows => 8, -cols => 3, -ipadx => 3, -variable => $xtvar, -selectmode => 'single', -selecttype => 'row', -resizeborders => 'none', -state => 'disabled', -cursor => 'top_left_arrow', -bg => 'white', -scrollbars => 'ose', )->pack; # Clean up if mouse leaves the widget $xtable->bind( '<FocusOut>', sub { my $w = shift; $w->selectionClear('all'); } ); # Highlight the cell under the mouse $xtable->bind( '<Motion>', sub { my $w = shift; my $Ev = $w->XEvent; if ( $w->selectionIncludes( '@' . $Ev->x . "," . $Ev->y ) ) { Tk->break; } $w->selectionClear('all'); $w->selectionSet( '@' . $Ev->x . "," . $Ev->y ); Tk->break; } ); # MouseButton 1 event $xtable->bind( '<1>', sub { my $w = shift; $w->focus; my ($rc) = @{ $w->curselection }; # Do something with the selection print " Selection: $rc\n"; } ); MainLoop;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-08-01 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (257 votes), past polls