Perl/Tk saves your favorite tools

back: Derived widget -1
next: Mega widget -1

(Full source of ConfigSpecs is a list of new and overruled widget-options. The options can be handled various ways. For derived widgets, the choice is limited: methods and passive options.

When the value of a METHOD-option is changed by configure or ConfigSpecs, Tk calls the method (function) with the corresponding name, passing-on the argument (always a scalar). A PASSIVE-option just stores the value to be used later.

A cget will call the METHOD-option's function without extra argument: the function shall return the setting. In this case, a PASSIVE-method just returns the internally stored value.

Within your own widget, you have to use cget to get your own passive values to facilitate the future extention of your new widget.

You may write

as equivalent to
  $obj->configure(-values => [4,5])
but in former case, the current values are not stored in the internal widget structure. In the latter it will. Also, the latter hides the internal organisation of the object better, providing ways for future improvements of the widgets behaviour.
Derived widget -1 Mega widget -1

Created by Mark Overmeer with PPresenter on 22 May 2000.