CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [lightspd] Tk and Tk::MListbox: Edit Log



wickedxter
User

Feb 12, 2013, 6:37 PM


Views: 654
Re: [lightspd] Tk and Tk::MListbox

from the module POD http://cpansearch.perl.org/src/RCS/Tk-MListbox-1.11/docs/MListbox.html


Quote
see( index )

Adjusts the view in the MListbox so that the row specified by index is visible. If the element is already visible then the command has no effect.



Quote
insert( index, @rows )

Inserts one or more rows into the MListbox before the element at index. A single row element is an array reference to the column values for that row. If an inserted row doesn't contain sufficient values to set each column for the row, than empty strings will be substituted.


What it looks like to me is your trying to insert headers in to the mlist


Code
  
my $searchRes = $top->DialogBox(-title => 'Search Results',
-buttons => ['OK', 'Cancel'],);
my @dispRes = qw(ID FirstName LastName); # your trying to add twice or have name clashes

my $ml = $searchRes->Scrolled(
qw/MListbox -selectmode single -scrollbars oe -font small /
)->pack(-expand => 1, -fill => 'both');

foreach my $colHdrs (@dispRes){
$ml->columnInsert('end',-text=>$colHdrs);
}

#### your adding already added column headers for data?
foreach (@dispRes){
push @row, $hash{$_}; <-- this is returned by another function, data dump shows no change.
}

$ml->insert('end', \@row);


This is what the insert takes if For a MListbox with four columns, the following would add three new rows


Code
$ml->insert("end", 
[qw/Row0:Col0 Row0:Col1 Row0:Col2 Row0:Col3/],
[qw/Row1:Col0 Row1:Col1 Row1:Col2 Row1:Col3/],
[qw/Row2:Col0 Row2:Col1 Row2:Col2 Row2:Col3/]
);



(This post was edited by wickedxter on Feb 12, 2013, 6:49 PM)


Edit Log:
Post edited by wickedxter (User) on Feb 12, 2013, 6:40 PM
Post edited by wickedxter (User) on Feb 12, 2013, 6:41 PM
Post edited by wickedxter (User) on Feb 12, 2013, 6:43 PM
Post edited by wickedxter (User) on Feb 12, 2013, 6:45 PM
Post edited by wickedxter (User) on Feb 12, 2013, 6:49 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives