Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Tk::Adjuster

by hiseldl (Priest)
on Sep 16, 2002 at 19:05 UTC ( [id://198337]=note: print w/replies, xml ) Need Help??


in reply to Tk::Adjuster

In order to add more than one Adjuster you will need to use packAfter for all but the first Adjuster when you are pack'ing them.

Here is a code snippet that demonstrates multiple Adjusters:

#!perl -w use strict; use Tk 800.005; use Tk::TList; use Tk::DirTree; use Tk::Frame; use Tk::Scrollbar; use Tk::Adjuster; use vars qw/%tk/; $tk{mw} = MainWindow->new(-background => 'white'); $tk{mw}->geometry('500x400'); $tk{top_frame} = $tk{mw}->Frame; $tk{left_frame} = $tk{mw}->Frame; # # The first adjuster separates the left from the right # and since we want to control the left_frame size, we # assign the left_frame as the -widget. # $tk{adjuster} = $tk{mw}-> Adjuster(-widget=> $tk{left_frame}, -side=>'left'); $tk{right_frame} = $tk{mw}->Frame; $tk{dir_tree} = $tk{left_frame}->Scrolled('DirTree', -height=>'0', -width=>'0', -scrollbars=>'e', ); $tk{output_list} = $tk{right_frame}->Scrolled('TList', -height=>'1', -width=>'1', -scrollbars=>'osoe',); # # Create an adjuster that controls the right frame's top # widget, the output_list. The -side attribute specifies # which side the widget is on. # $tk{output_adjuster} = $tk{right_frame}-> Adjuster(-widget=> $tk{output_list}, -side=>'top'); $tk{user_list} = $tk{right_frame}->Scrolled('TList', -height=>'1', -width=>'1', -scrollbars=>'osoe',); # # Create an adjuster that controls the right frame's # use_list widget. # $tk{user_adjuster} = $tk{right_frame}-> Adjuster(-widget=> $tk{user_list}, -side=>'top'); $tk{group_list} = $tk{right_frame}->Scrolled('TList', -height=>'1', -width=>'1', -scrollbars=>'osoe',); $tk{dir_tree}->chdir( "." ); $tk{top_frame}->pack(qw/-side top -fill x/); $tk{left_frame}->pack(qw/-side left -fill y/); # # Use the normal pack for the first Adjuster # $tk{adjuster}->pack(qw/-side left -fill y/); $tk{right_frame}->pack(qw/-side right -fill both -expand 1/); $tk{dir_tree} ->pack(qw/-side left -fill both -expand 1/); $tk{output_list} ->pack(qw/-side top -fill both -expand 1/); $tk{user_list} ->pack(qw/-side top -fill both -expand 1/); $tk{group_list} ->pack(qw/-side top -fill both -expand 1/); # # Use packAfter here (see the Tk::Adjuster docs # for explanation) # $tk{user_adjuster}-> packAfter($tk{user_list},qw/-side top -fill y/); $tk{output_adjuster}-> packAfter($tk{output_list},qw/-side top -fill y/); MainLoop;

If you are using the pack layout manager, you have to watch out for the order in which you pack the widgets or else you may get funny results.

--
hiseldl
"Act better than you feel"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-04-18 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found