Tk Source Code

View Ticket
Login
Ticket UUID: 967209
Title: TK_OPTION_NULL_OK not fully supported
Type: Bug Version: None
Submitter: jenglish Created on: 2004-06-05 18:06:06
Subsystem: 23. Option Parsing Assigned To: jenglish
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2026-09-24 20:37:40
Resolution: Fixed Closed By: jenglish
    Closed on: 2008-11-09 23:15:44
Description:
Tk_SetOptions() does not recognize the
TK_OPTION_NULL_OK flag bit for options of type
TK_OPTION_INT, TK_OPTION_BOOL, and a few others.

This causes a bug in the Tile widgets (current CVS
HEAD), which use  null defaults in several places.  For
example:

tlabel .l
.l configure -width [.l cget -width]
==> Error 'expected integer but got ""'

Workaround possible but this should be fixed in the core.
User Comments: serhiy.storchaka added on 2026-09-24 20:37:40:

Fixed in 9.0 by TIP 613 and TIP 618 ([1682ee1398], [a1ef1d4c3f]): TK_OPTION_NULL_OK is now supported for BOOLEAN, INT, DOUBLE, JUSTIFY, ANCHOR and the other value types, and SetOptions.3 documents it. 8.6 keeps its documented limitation. Closing.


jenglish added on 2009-10-28 00:31:47:
dburns reports on the Tcl'ers chat that this is causing problems for GUIB (a gui builder); if a user selects a value for one of the affected by-default-NULL options, it's imposible to reset it back to the default empty value.  Reopening.

jenglish added on 2008-11-19 22:03:22:
(Sorry, I added a comment when I changed the status, but it didn't get posted).

The documentation already states "Not all option types support the TK_OPTION_NULL_OK flag; for those that do, there is an explicit indication of that fact in the descriptions below [...]".

nijtmans added on 2008-11-19 16:02:49:
Why is this one invalid? If the documentation doesn't
mention this, either the documentation should be modified
to menthion that TK_OPTION_NULL_OK  is not supported
for some options, either the implementation should be
modified to allow TK_OPTION_NULL_OK for all options.

(I don't mind which solution is chosen, but I don't
think that this artifact is invalid)