The Disclosure Frame (dframe) widget
In Brief
This is a widget which controls the display and non-display of a sub-frame according to the click of its image or label.
Use a disclosure frame when you want to provide a simple default view of something but need to allow the user to view
more details or perform additional actions at times.
The frame "$w.frame" is managed by the widget. All 'disclosed' sub-widgets should be packed or gridded into
this one.
This widget appears in TclMacBag v0.11 and above.
Commands
::tclmacbag::dframe pathName ?Options?
This command initialises the disclosure frame.
Options:
- -label Text
The label to be presented to the user.
From v0.14: Creating the widget without a -label option creates a disclosure frame without a visible control. This
can be quite useful for providing areas which can be switched on and off at user will, such as status bars.
- -autoresize on|off
On Mac OS X, the usual behaviour when a dialog changes size (for example, due to a disclosure
frame becoming active) is for the window to automatically change size to suit.
Using this option enables this behaviour.
- -font fontName
Sets the font of the dframe's text label to a font defined by fontName.
This option exists in v0.13 and up.
::tclmacbag::dframe::Toggle pathName
This command allows you to programatically change the state of the disclosure frame from its current state (eg, open) to
its opposite (eg, closed).
::tclmacbag::dframe::ToggleTo pathName ?Options?
This command allows you to programatically toggle the state of the disclosure frame to a particular state (open or
closed).
Options:
Example
set w .sf ; set f $w.frame
grid [::tclmacbag::dframe $w -label "Details"] -row 1 -column 1 -sticky nsew
grid [ttk::label $f.l1 -text "Hello"] -row 1 -column 1 -sticky w
grid [ttk::label $f.l2 -text "World"] -row 2 -column 1 -sticky w
Further Information
As is standard, this widget returns with value of
pathName, for ease of use with geometry managers like grid and
pack.
While the -autoresize option handles the resizing, it does not (currently) have the animation effect
characteristic of Mac resizing (which appears to be done by taking a screen grab of the before and after
effects and fading between them). A plain resize effect may be unexpected to some Mac users.
The autoresize is only triggered when the vertical size of the toplevel has changed.