[EMAIL PROTECTED] wrote:

> (the ptk list seems dead so if anyone here can help that'd be great)

> I need to be able to return the item text but haven't been able to 
> figure it out.

Your question is ambiguous be more specific.

> #!/usr/bin/perl
> use strict;
> use Tk;
> use Tk::HList;
> use Tk::BrowseEntry;
> 
> my $mw = MainWindow->new;
> 
> # Mainwindow: sizex/y, positionx/y
> $mw->geometry("500x200+100+120");
> 
> # Default value
> &create_datagrid($mw);

If you want the sub to return the name, you could change this:

        my $name = create_datagrid ($mw);

and add this to the end of sub:

        return $customers[0]->[1];

or is there some other data you want ?

> MainLoop;
> 
> sub create_datagrid {
>     my $mother = shift;
> 
>     my @headers = ( "Financial status", "Name", "City", "Phone" );
>     my @customers = (
>         [ 'bad',  'Richard', 'Nuernberg', '123' ],
>         [ 'good', 'Roland',  'Fuerth',    '586' ],
>         [ 'fair', 'Peter',   'Zirndorf',  '933' ],
>     );
> 
>     my $grid = $mother->Scrolled(
>         'HList',
>         -head       => 1,
>         -columns    => scalar @headers,
>         -scrollbars => 'e',
>         -width      => 40,
>         -height     => 10,
>         -background => 'white',
>     )->pack();
> 
>     foreach my $x ( 0 .. $#headers ) {
>         $grid->header(
>             'create',
>             $x,
>             -text             => $headers[$x],
>             -headerbackground => 'gray',
>         );
>     }
> 
>     foreach my $row_number ( 0 .. $#customers ) {
>       my $unique_rowname = $row_number;
> 
>         $grid->add($unique_rowname);
>         foreach my $x ( 0 .. 3 ) {
>             $grid->itemCreate( $unique_rowname, $x,
>                 -text => $customers[$row_number]->[$x] );
> 
>             # You can change gridcontent later
>             $grid->itemConfigure( $unique_rowname, $x, -text => "don't 
> care" )
>               if rand > 0.5 and $x == 0;
>         }
>     }
> 
>     $grid->selectionSet(0);
>     
>     #idealy i want to store the name at row 0 column 1 in a variable
>     # i used numbers for the identifiers
>     print $grid->info("data",0);
>     
> }

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to