in reply to Problem with Hlist in Perl/TK

First of all, it is difficult to debug what you posted since the code you posted has only 1 row in the HList widget.
Second, I modified it a bit to add a second duplicate row, removed the $main references and it works fine for me.

#!/usr/bin/perl -w use strict vars; use Tk; require Tk::HList; my $helix_lf = MainWindow->new(); my $helix_result_list=$helix_lf->Scrolled('HList', -scrollbars => 'oe', -width => 50, -height => 20, -header => 1, -columns => 5, -selectbackground=>'green', -command =>\&change_hlist_bg )->pack(-expand=>1, -fill=>'both', -padx=>2, -pady=>2); $helix_result_list->headerCreate( 0, -text => 'Chain'); $helix_result_list->headerCreate( 1, -text => 'Ssqno'); $helix_result_list->headerCreate( 2, -text => 'Esqno'); $helix_result_list->headerCreate( 3, -text => 'Class'); $helix_result_list->headerCreate( 4, -text => 'Sequence'); $helix_result_list->add(helix_result_count); $helix_result_list->add(helix_result_count1); $helix_result_list->itemCreate(helix_result_count,0,-text=> "one"); $helix_result_list->itemCreate(helix_result_count,1,-text=> "two"); $helix_result_list->itemCreate(helix_result_count,2,-text=> "three"); $helix_result_list->itemCreate(helix_result_count,3,-text=> "four"); $helix_result_list->itemCreate(helix_result_count,4,-text=>"five"); $helix_result_list->itemCreate(helix_result_count1,0,-text=> "one"); $helix_result_list->itemCreate(helix_result_count1,1,-text=> "two"); $helix_result_list->itemCreate(helix_result_count1,2,-text=> "three"); $helix_result_list->itemCreate(helix_result_count1,3,-text=> "four"); $helix_result_list->itemCreate(helix_result_count1,4,-text=>"five"); MainLoop;

Hope this helps,
davidj

update:The reason I removed the references to "main" package is because I was getting the following error:
D:\PerlProjects\tests\HList.pl Entry "" not found at C:/Perl/site/lib/Tk.pm line 228.
Now, you may need the $main references. I couldn't tell by the code you posted. However, try taking them out and see if it works for you.

Replies are listed 'Best First'.
Re^2: Problem with Hlist in Perl/TK
by sandeep.ses (Acolyte) on Jul 08, 2004 at 02:07 UTC
    the reason i had one row was because i have it called in a subroutine . and the subroutine gets called whenever i need to add a row . so removing main:: will not help me . it would give me variable not found error.
      With what you have posted, it is impossible to say why your code is not working. Post more of it, all if possible. It will be easier to check.

      davidj