Next: Putting Widgets Inside Up: PanedWindow Previous: PanedWindow


Adding Panes Inside a TixPanedWindow Widget 

You can create a TixPanedWindow widget using the tixPanedWindow command. After that, you can add panes into this widget using the add method (see program 2-5).

When you use the add method, there are several optional parameters which you can use to control the size of each of the pane. The -min parameter controls the minimum size of the pane and the -max parameter controls its maximum size. These two parameters controls how much the user can expand or shrink a pane. If neither is specified, then the pane can be expanded or shrunk without restrictions.

In addition, the -size parameter specifies the initial size of the pane. If it is not specified, then the initial size of the pane will be its natural size.

In program 2-5, we set the initial size of pane1 to 100 pixels using the -size parameter. We don't set the -size parameter for pane2 so it will appear in its natural size. However, we use the -max option for pane2 so that the user can never expand the size of pane2 to more than 300 pixels.

tixPanedWindow .p
.p add pane1 -size 100
.p add pane2 -max 300

set p1 [.p subwidget pane1]
button $p1.b1 -text Button1
button $p1.b2 -text Button2
pack $p1.b1 $p1.b2 -side left -expand yes

set p2 [.p subwidget pane2]
button $p2.b -text "Another Button"
pack $p2.b -side left -expand yes -fill both

pack .p -expand yes -fill both

(Figure 2-5) Adding Panes into a TixPanedWindow Widget