Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Tk scrollbar

by Perluser (Novice)
on Oct 28, 2004 at 02:44 UTC ( [id://403233]=note: print w/replies, xml ) Need Help??


in reply to Re: Tk scrollbar
in thread Tk scrollbar

My original post was a greatly simplified version. A bit more complicated is this: I have to use grid because with two listboxes below I need labels to stick out nicely right above corresponding lists. And I want one scrollbar to scroll both lists:
$top = new MainWindow; $f = $top->Frame; $f->Label(-text=>"1")->grid('x',$f->Label(-text=>"2")); $f->Listbox()->grid($f->Scrollbar(),$f->Listbox()); $f->pack(-side=>'left'); MainLoop;
Even with one Listbox it appeared that I cannot control how scrollbar is shown in grid. Or, can I?

Replies are listed 'Best First'.
Re^3: Tk scrollbar
by kelan (Deacon) on Oct 28, 2004 at 13:26 UTC

    To get your widgets to stretch using the grid manager, you need to specify the -sticky attribute. Basically for a given widget, you tell grid which sides (n,s,e,w) should "stick", and it makes sure those sides of the widget always touch the appropriate border of the widget's grid cell. In this case, you want the scrollbar to extend all the way from the top of the cell to the bottom, so you want the top (n) and bottom (s) of the widget to stick:

    $f->Listbox()->grid($f->Scrollbar(), -sticky => 'ns');

      Yes, that's what I wanted. Thanks to everyone.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 23:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found