::tycho::TWidget
-
Source File -
Contents:
itk_options
- public methods
The subpanel can be initially in an open or closed state. The -childwidget option specifies the widget to pack into the subpanel when the drawer is opened. Note that one childwidget cannot be packed into two different subpanels. The -text option specifies the text that is to be inserted into the label portion of the subpanel. The -state option specifies the state that the user would like the subpanel to have: either closed or open. One can query the current state of the subpanel by using [cget -state]. By default, the subpanel is initially closed.
Here is an example of how to use the Subpanel:
::tycho::Displayer .w
frame .w.options
checkbutton .w.options.a -text A
checkbutton .w.options.b -text B
pack .w.options.a
pack .w.options.b
::tycho::Subpanel .w.s -text "Options" -childwidget .w.options
pack .w.s -anchor w
wm deiconify .w
This example first creates a window with a status bar (and a close
button), then creates a frame a populates it with checkbuttons.
It then creates a Subpanel
that uses the frame with
checkbuttons as it's child widget. When the "open" button is pushed,
that frame is packed. When it is pushed again, that frame is unpacked.
As an alternative to the -childwidget option, the -opencallback option specifies a command to execute when the subpanel is opened. This should return the name of a widget to be packed into the subpanel. Thus, the frame to display can be constructed on-the-fly. The -closecallback option specifies the command that is executed when a subpanel is closed.
For example,
proc nb {} {
button .x.b -text push
return .x.b
}
::tycho::Displayer .x
::tycho::Subpanel .x.s -text "Button"
.x.s configure -opencallback nb
.x.s configure -closecallback "destroy .x.b"
pack .x.s -anchor w
wm deiconify .x
If both the childwidget and the opencallback options are are used then the one that is specified last will be used. The deletion of the embedded widget is left to the creator.
-childwidget
-closecallback
-opencallback
-state
closed
-text
close
open