TIP 110: Add a Tristate Mode to the Checkbutton and Radiobutton

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Author:         Brian Griffin <bgriffin@model.com>
State:          Final
Type:           Project
Vote:           Done
Created:        01-Oct-2002
Post-History:   
Tcl-Version:    8.5

Abstract

This TIP proposes adding a third value (tristate) to the checkbutton and radiobutton widgets and corresponding display.

Rationale

In order to meet more demanding requirements of todays complex graphical user interfaces, it would help add to the functionality of the basic checkbutton and radiobutton widgets. To support using checkbuttons and radiobuttons along with multiple selection, it is necessary for these buttons to be able to display a third state, i.e., both On and Off. This indicates the situation where a property has a particular value for some members of a selection set, but not others.

Proposed Change

The change would add a third "tristate" value to current On Off values of the checkbutton and radiobutton widgets. The widget would then display the check/dot mark (as appropriate) along with a "grayed" background, for example. When the checkbutton or radiobutton is invoked (i.e. clicked on) it would behave exactly as it does currently, setting the variable to the On value.

There is a concern that the Unix version of these widgets do not have a sufficiently different appearance when in the tristate state compared with the On and Off states. This issue is addressed in [109].

Propsal Specifics

  1. Identify a third, platform specific, presentation (e.g. check with grayed background) to represent the tristate value,

  2. Add the option "-tristatevalue" to specify the match value only. The default value of this option will be "{}",

  3. Change the behavior to display the indeterminate or tristate presentation when the associated variable's value matches the -tristatevalue, and

  4. Add the option "-tristateimage" to specify an image to display (in place of the image option) when the checkbutton or radiobutton has the tristate value (as defined above.)

Copyright

This document has been placed in the public domain.

History