Tk Library Source Code

View Ticket
Login
Ticket UUID: 3168761
Title: Themed widgets cause Tcl errors
Type: Bug Version: None
Submitter: zoro2 Created on: 2011-01-31 16:13:35
Subsystem: bwidget Assigned To: oehhar
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2011-02-14 23:58:30
Resolution: Fixed Closed By: oehhar
    Closed on: 2011-02-14 16:57:44
Description:
Multiple widgets - including Entry, LabelFrame and LabelEntry cause errors when used after [Widget::theme 1] was called.

Included are fixes I made against 1.9.4 release.
User Comments: oehhar added on 2011-02-14 23:58:30:
Modified patch committed to csv.

oehhar added on 2011-02-14 00:55:36:
Answer from Wojciech by E-Mail:

I found some time to doublecheck it today - you were right - it should
be ![Widget::theme]. In my case it crashes if theme is set and state
is set to disabled.

oehhar added on 2011-02-04 14:38:57:
Dear Wojciech, dear George,
thank you for the bug report, patch, and succesful test (all on c.l.t).
Unfortunately, here are no test cases (I would like to have easy demo scripts).

I have sent two questions about the patch to Wojciech by private mail.
He replayed, that he is not at home at the moment and it will take one week.
It is the same for me, I will be on holiday the next week.

Here are the questions and the preliminary answers:

-- Q1 --
> Sorry, question about your patch for BWidget Entry themed:
>
> Patch line 82:
>
> -    if { $chstate || $chfg || $chdfg || $chbg || $chdbg } {
> +    if { [Widget::theme] && ($chstate || $chfg || $chdfg || $chbg ||
> $chdbg) } {
>
> Isn't an inverted logic more appropriate ?
> Thus:
> +    if { ![Widget::theme] && ($chstate || $chfg || $chdfg || $chbg ||
> $chdbg) } {
>
> Otherwise, "Widget::cget $path -disabledforeground" is executed two rows
> below which should IMHO fail...

-- A1 --
It is a good point.

I think I converted all the code without testing all possible paths -
I originally did this for a product I am working on and I guess we
never came across this issue.

---Q2---
> Sorry, another question about your patch for BWidget Entry themed:
>
> Patch line 90:
>
> -            return [eval [linsert $larg 0 $path:cmd $cmd]]
> +            return [uplevel 2 [linsert $larg 0 $path:cmd $cmd]]
>
> This should be a general optimisation, to evaluate the command in the
> caller space. May you make any comments on this ?
> Is this for error message purposes or what ?

--A2--
The issue was ttk specific I think - from what I remember ttk bindings call:

$widget instate {...} {some script}

which fails since instate is not invoked in proper level - i.e. you can do
set bg [$widget cget -something]
$widget instate {!background} {$widget configure -background $bg}
(this is just a quick sample, but ttk events used instate, which crashed)

zoro2 added on 2011-01-31 23:13:36:

File Added - 400347: bwidget1.9.4.patch

Attachments: