I'll give you a simple example. My base widget is a frame ($frame). It has two children: $label and $entry. One attribute is -text. I redirect this attribute to $label like so:
$frame->ConfigSpecs(-text => [ $entry ] );
$label->ConfigSpecs(-text => [ 'SELF', 'text', 'Text', undef ] );
Works great. However, I want to define a second parameter called -data that I want to pass to $entry. Essentially I want to assign the value of -data to the -text attribute of $entry. This is what I thought I could do, but it doesn't work:
$frame->ConfigSpecs(-text => [ $entry ], -data => [ $label ]);
$label->ConfigSpecs(-text => [ 'SELF', 'text', 'Text', undef ]);
$entry->ConfigSpecs(-data => [ 'SELF', 'text', 'Text', undef ]);
But this doesn't work. I get the following error:
Tk::Error: Can't set -data to `Some data here' for Tk::Explorer=HASH(0x42d528): unknown option "-data" at /usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/Tk/Derived.pm line 294.
Anyone know how to define a new attribute name that is not already defined?
In reply to How do you create a new attribute for a Tk::Widget? by rzer10
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |