TclMacBag - Bag of Mac Widgets for Tcl/Tk
The Disclosure Frame (dframe) widget

HomeF.A.QChangelogLicenseAbout

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:

::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.

© Peter Caffin, 2010-2017.