Menu

#1552 Problem with nonexistent namespaces

obsolete: 8.5a0
open
5
2003-10-06
2003-08-23
Les Cargill
No

Platform:

Win98SE,Wish8.3for Windows.

Description:

It is possible to assign the "-textvariable <name>" option
to an entry widget using a namespace that does not
yet exist.

After the namespace and variable are instantiated, changes to
the variable are not reflected within the text widget.

Subsequent ".entry config -textvariable <name> "
commands do not clear up the problem.

Code snippet:
entry .foo -textvariable fred::foo(wha)

namespace eval fred {
variable foo
}

grid .foo

set fred::foo(wha) "Hey!"

Discussion

  • Don Porter

    Don Porter - 2003-10-03
    • priority: 5 --> 8
     
  • Don Porter

    Don Porter - 2003-10-03
    • assigned_to: hobbs --> dgp
     
  • Don Porter

    Don Porter - 2003-10-06

    Logged In: YES
    user_id=80530

    confirmed in 8.4x and HEAD
    Looks like it may really be
    a bug in variable traces.

     
  • Don Porter

    Don Porter - 2003-10-06
    • milestone: --> obsolete: 8.5a0
    • priority: 8 --> 5
    • assigned_to: dgp --> hobbs
     
  • Don Porter

    Don Porter - 2003-10-06

    Logged In: YES
    user_id=80530

    It appears that the [entry] code was
    written with the assumption that
    Tcl_SetVar() always succeeds
    in creating a variable, and Tcl_TraceVar
    always succeeds in creating a trace.
    Those calls do not automatically
    create missing namespaces, so they
    actually fail when directed to work on
    a variable in a namespace that does
    not (yet) exist.

    The workaround, of course, is to create
    namespaces before tying widgets to
    them.

    An actual fix has to wait until a time
    when Tcl might be modified to
    create namespaces as they
    are needed. See Tcl RFE 582926.
    That will not happen in an 8.4.x release.

     
MongoDB Logo MongoDB