Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Tk::HList->yview

by blogan (Monk)
on Jul 03, 2002 at 01:40 UTC ( [id://179038]=perlquestion: print w/replies, xml ) Need Help??

blogan has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to create an HList that will start out by being scrolled to the bottom. I have the following:
#!/usr/bin/perl -w use Tk; use Tk::HList; use strict; my $i; my $mw = MainWindow->new(-title => "HList Example"); my $list = $mw->Scrolled("HList", -header => 1, -columns => 1, -scrollbars => "ose" )->pack; $list->header('create', 0, -text => "Num"); for ($i = 0 ; $i < 100 ; $i++) { $list->add($i); $list->itemCreate($i, 0, -text => $i); } $list->yview('moveto', 1); MainLoop;
This will create the list, but it will be at the top, not the bottom. perl 5.6.0 for Linux, Tk 800.023. Any suggestions?

Replies are listed 'Best First'.
Re: Tk::HList->yview
by yodabjorn (Monk) on Jul 03, 2002 at 02:55 UTC
    try:
    $list->see(99) ;
    this was from perldoc Tk::HList
    $hlist->see($entryPath)
    Adjust the view in the HList so that the entry given by $entryPath is visible. If the entry is already vis­ ible then the method has no effect; if the entry is near one edge of the window then the HList scrolls to bring the element into view at the edge; otherwise the HList widget scrolls to center the entry.

    My version of your list:
    use Tk; use Tk::HList; use strict; use warnings ; my $i; my $mw = MainWindow->new(-title => "HList Example"); my $list = $mw->Scrolled("HList", -header => 1, -columns => 1, -scrollbars => "ose" )->pack; $list->header('create', 0, -text => "Num"); for ($i = 0 ; $i < 100 ; $i++) { $list->add($i); $list->itemCreate($i, 0, -text => $i); } $list->see(99) ; MainLoop;
    Enjoy!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://179038]
Approved by blakem
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found