For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > April 2006 > Editable List









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Editable List
doleman

2006-04-03, 7:03 pm

What kind of widget schould i use for a list with 2 columns and aprox.
30 entries, that can be edited in the list? I found only the tixgrid
widget. Is tixgrid the only list like widget which supports editing
values in the list?
thanks

zentara

2006-04-04, 7:59 am

On 3 Apr 2006 13:22:09 -0700, "doleman" <doleman@gmx.de> wrote:

>What kind of widget schould i use for a list with 2 columns and aprox.
>30 entries, that can be edited in the list? I found only the tixgrid
>widget. Is tixgrid the only list like widget which supports editing
>values in the list?
>thanks


TableMatrix would be a good choice, however I've had some trouble
getting it to compile and install under Perl 5.8.8

You could just roll your own, putting your data into a hash (convenient
for saving to disk with Storable), then making a grid of labels and
entries.


#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::Pane;

my $mw = new MainWindow();
my $pane = $mw->Scrolled( 'Pane',
-scrollbars => 'e', )
->pack(-expand => 1, -fill => 'both');

#my %items = ( A => [1,1a], B => [2,2a], C => [3,3a] );

my $count = 0;
my %items = ();
for('A'..'Z','a'..'z'){
$count++;
$items{$_} = [$count, "$count-a"];
}

my $row = 0;
foreach my $item ( sort keys(%items) ) {

#print @{$items{$item}},"\n";

$pane->Label(
-text => $item,
-anchor => "w",
-relief => 'solid', #will show gridlines
)->grid( -row => $row, -column => 0 );

$pane->Entry(
-textvariable => \$items{$item}[0],
-width => 15,
-relief => 'solid', #will show gridlines
)->grid( -row => $row, -column => 1 );

$pane->Entry(
-textvariable => \$items{$item}[1],
-width => 15,
-relief => 'solid', #will show gridlines
)->grid( -row => $row, -column => 2 );


$row++;
}

MainLoop();

__END__


--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
doleman

2006-04-04, 7:00 pm

looks pretty good i have research it. :)
thanx

doleman

2006-04-04, 7:00 pm

the problem is that this list should be part of a bigger application
wich is like the windows explorer i have on the left side a tree widget
(which has adjustable width) and on the right side a notebook including
this list. so i need to expand it because of the adjustable tree. it
would be very good if i can make the list (2 columns 1 label and 1
editable) adjustable to shrink expand the width of all columns.
thanks alot

doleman

2006-04-05, 4:02 am

i tried the tablematrix widget it seems to have all features i
need.....
i had no problems compiling it.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com