Tk Library Source Code

View Ticket
Login
Ticket UUID: 3437761
Title: keyboard traversal broken if spaces in widget pathnames
Type: Bug Version: None
Submitter: jaspertheperson Created on: 2011-11-14 12:12:12
Subsystem: bwidget Assigned To: oehhar
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2011-11-14 22:31:34
Resolution: Fixed Closed By: oehhar
    Closed on: 2011-11-14 14:29:09
Description:
If you have widgets whose pathnames contain spaces, you get errors when attempting to traverse focus between them with the Tab key. Example error log pasted below. 
Annoyingly, this error affects all Tk widgets including ttk, once the BWidget package has been loaded.

wrong # args: should be "ttk::takefocus w"
    while executing
"ttk::takefocus .foo bar"
    ("uplevel" body line 1)
    invoked from within
"uplevel \#0 $value $w"
    (procedure "focusOK" line 12)
    invoked from within
"focusOK $cur"
    (procedure "Widget::focusNext" line 36)
    invoked from within
"Widget::focusNext .foo\ foo"
    invoked from within
"Widget::traverseTo [Widget::focusNext .foo\ foo] "
    (command bound to event)
User Comments: oehhar added on 2011-11-14 22:31:34:
I am not happy that the original is overwritten and I suppose, there are other issues with this. Nevertheless, it seams to work now.

jaspertheperson added on 2011-11-14 22:13:31:
This change fixes the issue for me.
Note that the original issue appeared even if no BWidgets were displayed -- it appears the BWidget traversal handling routines were somehow overwriting the base Tk and Tile versions of the same routines. This in itself is also a bug.

oehhar added on 2011-11-14 21:01:07:

File Added - 428417: widget.tcl

oehhar added on 2011-11-14 20:59:59:
Thank you for the report.
I tried with current BWidget 1.9.5 and TCL 8.5.11 on Windows Vista:
package require BWidget
pack [Entry .foo\ foo]
pack [ttk::entry .foo\ foo\ 2]

The error appeared.
When line 1438 of "widget.tcl" in function Widget::focusOK is changed from
    set value [uplevel \#0 $value $w]
to
    set value [uplevel \#0 [list $value $w]]
the error disapears for me.
This change seams logic to me as uplevel uses concat to assemble its arguments.

Could you please confirm if this fixes the issue ?
The modified "widget.tcl" file is attached for your convenience.

-Harald

Attachments: