Tk Library Source Code

View Ticket
Login
Ticket UUID: 710658
Title: Focusproblem with Widget::focusOK
Type: Bug Version: None
Submitter: rniva Created on: 2003-03-27 11:04:47
Subsystem: bwidget Assigned To: jenglish
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-05-19 00:26:58
Resolution: Fixed Closed By: jenglish
    Closed on: 2003-05-18 17:26:58
Description:
We have some internally developed widgets which return
an empty string on unknown commands/options. This
causes problems for Widget::focusOK in widget.tcl,
which uses cget -editable:

Errorinfo: can't use empty string as operand of "!"
    while executing
"if {($code == 0) && !$value} {
        return 0
    }"
    (procedure "focusOK" line 27)
    invoked from within
"focusOK $cur"
    (procedure "Widget::focusNext" line 36)
    invoked from within
"Widget::focusNext .apar2"
    invoked from within
"focus [Widget::focusNext .apar2]"
    (command bound to event)

May I suggest that line 1301 in widget.tcl is changed from:

    if {($code == 0) && !$value} {

to:

    if {($code == 0) && $value == 0} {

which is not only safer, but also easier to read, imo.
User Comments: jenglish added on 2003-05-19 00:26:58:
Logged In: YES 
user_id=68433

This looks reasonable to me.  Patch committed (widget.tcl
r1.24).