|
|
|
|
|
To define an option and associate some action with it, callConfigSpecs like this: |
|
|
|
 |
|
|
|
|
$cw->ConfigSpecs(-newoption => [ <action>, "newOption",
"NewOption", <fallbackvalue> ]); |
|
|
|
|
|
|
|
|
The option you are creating the action for is listed first, and the second argument is an anonymous list consisting of four items. The first item is the action you want to take and should be"DESCENDANTS","ADVERTISED","SELF","CHILDREN","PASSIVE","METHOD","CALLBACK", or a$reference to a subwidget. The second and third items in the list have to do with the option database and can be left blank if you prefer. The fourth item is the default value of that option, usally undef or"" or whatever you want the default value of that option to be if the user doesn't specify it. |
|
|
|
|
|
|
|
|
The action part of the list defines what happens. Each possible value is defined as follows: |
|
|
|
 |
|
|
|
|
DESCENDANTS
The configure for that option will be applied recursively to all descendants. |
|
|
|
 |
|
|
|
|
ADVERTISED
The configure will be applied to all advertised subwidgets. |
|
|
|
 |
|
|
|
|
SELF
The configure will be applied to the base widget (in this case, a frame, but the base widget can also be another composite widget). |
|
|
|
 |
|
|
|
|
CHILDREN
The configure will beapplied to all children. |
|
|
|
 |
|
|
|
|
PASSIVE
The value will be stored in$args. This is the way you would useConfigSpecs on any options that can be used at create time or bycustom methods of your composite widget. |
|
|
|
 |
|
|
|
|
METHOD
The method with the samename as the option will be called. For instance, if you call $cw->ConfigSpecs(-newoption => ["METHOD", "", "", undef]) and then the user uses the-newoption option, the method newoption(which you still have to define in the file somewhere) will be invoked. When you cannot define anoption with one of the other settings, you can use METHOD. |
|
|
|
 |
|
|
|
|
CALLBACK
Invokes a method insideyour composite widget if that option is configured or sent when the widget is created. For instance,$cw->ConfigSpecs(-myopt => ["CALLBACK", "myMethod", "MyMethod", undef]) would call the |
|
|
|
|