Tk Library Source Code

View Ticket
Login
Ticket UUID: 2962077
Title: error if an array element is used as -textvariable
Type: Bug Version: None
Submitter: wtschueller Created on: 2010-03-02 18:09:25
Subsystem: tklib :: ipentry Assigned To: afaupell
Priority: 5 Medium Severity:
Status: Open Last Modified: 2026-11-16 00:07:23
Resolution: None Closed By:
    Closed on:
Description:
Steps to reproduce:

puts [ info patchlevel ]
puts [ package require -exact ipentry 0.2 ]
set foo(bar) 1.1.1.1
::ipentry::ipentry .ip -textvariable foo(bar)
catch { set foo(bar) 1.1.1.2 } msg
puts $msg
exit

output for version 0.2:
8.4.19
0.2
1.1.1.2

output for version 0.3
8.4.19
0.3
can't set "foo(bar)": can't read "var": variable is array

Expected:
no error in both cases

I saw a big rework in ipentry.tcl from 1.13 to 1.14 that changed
::ipentry::traceVar to ::ipentry::traceFired and eliminated the
test if { $key != "" }

Is this a bug or a feature?
User Comments: serhiy.storchaka added on 2026-11-16 00:07:23:

Proposed fix in branch ipentry-array-textvariable.

The trace procedures used the variable name passed to the trace, which for an array element does not include the element. They now use the name the widget was configured with. This fixes ipentry6 too.


wtschueller added on 2010-04-11 15:12:48:

File Added - 370157: 2962077-reenable-array-elements-as-textvars.patch

Attachments: