Tk Source Code

View Ticket
Login
2026-10-08
17:08 • Ticket [f16cdb6d] Aqua: widgets not mapped immediately status still Open with 3 other changes artifact: defe8dff user: chrstphrchvz
2022-10-20
20:58 • Ticket [a64a4b33] Scale does not appear until window clicked in status still Open with 3 other changes artifact: 9d386208 user: fvogel
2022-10-08
14:34 • Ticket [bfea11a9] Aqua: update idletasks handles timer events status still Pending with 3 other changes artifact: 56eb2bcd user: chrstphrchvz
2022-09-22
20:19 • Ticket [a64a4b33] Scale does not appear until window clicked in status still Open with 3 other changes artifact: 82e92581 user: nab
16:00 • Ticket [a64a4b33]: 4 changes artifact: 0499f586 user: marc_culler
08:22 • Ticket [a64a4b33]: 3 changes artifact: 3a5a661b user: nab
2022-09-21
18:06 • Ticket [a64a4b33]: 4 changes artifact: b1f59562 user: marc_culler
17:24 • Ticket [a64a4b33]: 3 changes artifact: a9e49bb8 user: nab
16:39 • Ticket [a64a4b33]: 5 changes artifact: 94d77b2e user: marc_culler
04:42 • Ticket [a64a4b33]: 4 changes artifact: 55fd8d0b user: marc_culler
04:36
Fix [a64a4b331e]: Aqua widgets sometimes do not appear on app startup. leaf check-in: 151f1280 user: marc_culler tags: bug-a64a4b331e
2022-09-20
17:34 • Ticket [a64a4b33] Scale does not appear until window clicked in status still Open with 3 other changes artifact: 59c57ce8 user: chrstphrchvz
17:32 • Ticket [a64a4b33]: 3 changes artifact: ef4fd35e user: chrstphrchvz
16:29 • New ticket [a64a4b33]. artifact: 70c1f25c user: jal_frezie

Ticket UUID: a64a4b331ecc0cd3a86321f23451d998161f8147
Title: Scale does not appear until window clicked in
Type: Bug Version: 8.6.12 Aqua
Submitter: jal_frezie Created on: 2022-09-20 16:29:29
Subsystem: 66. Aqua Window Operations Assigned To: marc_culler
Priority: 5 Medium Severity: Severe
Status: Open Last Modified: 2022-10-20 20:58:30
Resolution: None Closed By: nobody
    Closed on:
Description:
If you put a command that draws a scale widget in a file, e.g., 
pack [scale .s -from 10 -to 1000 -variable freq]
and then execute it by going
% wish <filename.tcl>
...the toplevel window appears the size it needs to be to show the scale widget, but the widget does not appear. It does appear as soon as you click in the toplevel, and you can then interact with it normally.
If you start wish interactively, and then either enter the command directly or source the file, the scale appears immediately as it should.
User Comments: fvogel added on 2022-10-20 20:58:30:
Is this merge-able?

nab added on 2022-09-22 20:19:13:
well... forget about it...
moving the latest update idletasks before the deiconify did the trick.
logo is always redrawn.

++

marc_culler (claiming to be Marc Culler) added on 2022-09-22 16:00:54:
Thank you Nicolas.  Your report puzzles me.  First, the patch was meant
to make sure everything get displayed when the root toplevel is mapped.
Second, the patch should only affect the display of the root toplevel.
The code path for displaying a non-root toplevel should be the same
as it was before.

You are saying that the patch affects the display of a different toplevel,
and that it has the opposite effect -- something is *not* being displayed.  

There must be an error in the logic.

nab added on 2022-09-22 08:22:37:
Hi,
I saw one error with the proposed code...
When I launch my app there's a splash screen that display the logo, then when everything is ready the main window is displayed and the splash screen is destroyed.

With the proposed code in the bugfix branch, the logo is not always displayed in the splash screen.
the splash screen is always displayed but sometimes it appears empty.

here's proc:
proc showInitSplashScreen {logoFile} {
    
    set t .transient
    set w $t.c
    
    wm withdraw .
    update idletasks
    toplevel $t
    wm withdraw $t
    update idletasks
 
    if {[tk windowingsystem] eq "aqua"} {
        wm overrideredirect $t 1
        wm attributes $t -topmost 1
    } else {
        wm overrideredirect $t 1
        wm transient        $t
        if {[tk windowingsystem] ne "win32"} {
            wm attributes $t -type splash -topmost 1 -alpha 0.7
        } else {
            wm attributes $t -alpha 0.7 -topmost 1
        }
    }
    
    if {$logoFile ne "" } {
        set img [image create photo -file $logoFile]
        set height [image height $img]
        set width  [image width  $img]
        canvas $w -width $width -height $height -bg black
        $w create image 0 0 -anchor nw -image $img
    } else {
        canvas $w
        set width  [winfo reqwidth  $t]
        set height [winfo reqheight $t]
    }
    
    #
    # Center the window
    #
    set x [expr { ( [winfo vrootwidth  $t] - $width  ) / 2 }]
    set y [expr { ( [winfo vrootheight $t] - $height ) / 2 }]
    
    wm geometry $t ${width}x${height}+${x}+${y}
    
    grid $w -sticky news
    grid rowconfigure $t all -weight 1
    grid columnconfigure $t all -weight 1

    wm deiconify $t
    update idletasks
}

marc_culler (claiming to be Marc Culler) added on 2022-09-21 18:06:37:
Thank you Nicolas!  Yes, it matters.

nab added on 2022-09-21 17:24:16:
Hi,
if it matters... I've applied the proposed code to mac_styles_87 branch and worked with it for a day without noticing any side effect.
I'll work with it during the next two days and report
(I didn't test the script, I've worked with my app).

++

marc_culler (claiming to be Marc Culler) added on 2022-09-21 16:39:06:
This bug was marked with priority "severe".  If that means that it is
important for it to get fixed before the 8.6.13 release then it would be
wise to review the proposed fix soon.

marc_culler (claiming to be Marc Culler) added on 2022-09-21 04:42:23:
I created a bug-fix branch bug-a64a4b331e for this problem.  It seems
to work correctly for the simple script above as well as for the simple
script in [f16cdb6d04], and it passes all of the non-regression tests
on my computer.

But of course this is exactly the sort of change that one can expect
will have unexpected side effects.  So careful testing would be needed.

chrstphrchvz added on 2022-09-20 17:34:01:

Wrong script in previous comment, it should instead say:

pack [scale .s -from 10 -to 1000 -command bogus]
.s set 500


chrstphrchvz added on 2022-09-20 17:32:22:

I believe this is another example of [f16cdb6d04]. Using this slightly different script:

pack [scale .s -from 10 -to 1000]
.s set 0

the invalid command name "bogus" error does not occur until the widget actually appears. The workaround of doing update idletasks; event generate .s <Expose> also applies.