Tk Library Source Code

View Ticket
Login
Ticket UUID: 772461
Title: snit: Allow masking of options (undefine)
Type: RFE Version: None
Submitter: andreas_kupries Created on: 2003-07-16 16:56:49
Subsystem: snit Assigned To: duquette
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-11-22 06:16:12
Resolution: Closed By: duquette
    Closed on: 2003-11-21 23:16:12
Description:
I wrote a 'mklabel' (adaptor) which gets
its information from a metakit view/cursor. It 
has a new
option, handled in the megawidget, and uses 
the label's
-text and -textvariable to set the data.

I don't want the megawidget to expose -text, 
nor
-textvariable. I currently have to alternatives 
for doing so:

1)List all options of the label we expose 
and
delegate them individually.

- Long list, error prone, break when 
label gets more
  options (= maintenance problem).

2)Delegate option * and define -text -
textvariable
on the megawidget level, with 
onconfigure/oncget
as no-ops.

- Still exposes the variables, although 
as nulls.
  Setting them has no effect, reading 
returns empty
  string

I would like to be able to 'undefine' an option. 
Causing the
megawidget to know: This option is illegal, not 
defined for
the megawidget, nor must it be delegated.

Then I would be able to

undefine -text
undefine -textvariable
delegate option * to hull

for my label, making it safe against unwanted 
manipulation of
the contents.
User Comments: duquette added on 2003-11-22 06:16:12:
Logged In: YES 
user_id=372859

This was implemented in Snit 0.9, as the "except" clause on the 
delegate command.

duquette added on 2003-10-21 09:19:29:
Logged In: YES 
user_id=372859

The "except" clause should be made to work for "delegate method 
*" as well.

andreas_kupries added on 2003-07-18 07:04:15:
Logged In: YES 
user_id=75003

Yes, that would work ...

delegation option * to hull except {
    -text -textvariable
}

This looks ok.

duquette added on 2003-07-18 06:59:37:
Logged In: YES 
user_id=372859

The only case in which this arises is if you use "delegate option * 
to...".  So what if the full syntax was "delegate option * to 
<widget> except <list_of_exceptions>"?