The Disclosure Button (dbutton)

In Brief

The Disclosure Button is a small button which exposes and hides a frame.

It is similar in functionality to the Disclosure Frame, except: (a) it is displayed as a button instead of a triangle and label, (b) the exposed widget need not be directly underneath it, (c) it tends to be used in different situations.

The widget appears in Apple's Human Interface Guide in Section 7.

This widget appears in TclMacBag v0.11 and above.


::tclmacbag::dbutton pathName ?Options?

Required Options:


::tclmacbag::dbutton::Toggle pathName

This command allows you to programatically change the state of the disclosure button from its current state (eg, open) to its opposite (eg, closed).

::tclmacbag::dbutton::ToggleTo pathName ?Options?

This command allows you to programatically toggle the state of the disclosure button to a particular state (open or closed).



# Set up the contoller widget
grid [::tclmacbag::dbutton .b -pathname .e \
  -gridopts {-column 2 -row 1}] -column 1 -row 1
# Set up the disclosed/hidden frame.
ttk::frame .e
grid [ttk::label .e.l1 -text "Hello world."]

Further Information

At this stage, only the Grid geometry manager is supported by this widget. Pack may be supported at a later date. Place is unlikely to ever be supported.

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.