Tk Source Code

View Ticket
Login
Ticket UUID: f16cdb6d04e4d1f4b53c221f2915016157cc3a1c
Title: Aqua: widgets not mapped immediately
Type: Bug Version: 8.6.12
Submitter: chrstphrchvz Created on: 2022-04-09 14:03:48
Subsystem: 66. Aqua Window Operations Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-10-09 03:55:16
Resolution: None Closed By: nobody
    Closed on:
Description:

Tcl::pTk has a bgerror test similar to the following:

pack [listbox .l -yscrollcommand bogus]
.l insert 0 foo

It expects an error regarding the invalid `-yscrollcommand` to be generated immediately (at least before a timeout). But currently on Tk Aqua the listbox and the error never appear automatically; I do not observe a similar issue on X11. The listbox and the error appear if an event is sent to it, e.g. update; event generate .l <Expose>; update idletasks.

User Comments: marc_culler (claiming to be Marc Culler) added on 2026-10-09 03:55:16:
Here is another argument.

As far as I can tell both your original script and the amended version
work fine in the bug-40dc19ee9e branch.  The fix in that branch changes
nothing except for the updateLayer method in 9.1.  Since 8.6 does not even
have an updateLayer method at all, the 8.6 issue could hardly be the same
as the 9.1 issue.

When I run the scripts in bug-40dc19ee9e the toplevel never turns red
but the listbox containing foo appears in the window and the error dialog
also appears. If I add a call to update idletasks before the pack command
then I do see a flash of red before the listbox covers it up.  I think that
is the expected behavior.

chrstphrchvz added on 2026-10-09 01:07:38:

To further argue that the issue seen under 8.6 is distinct from the one seen in recent 9.0/9.1, consider an amended example:

. configure -background red
pack [listbox .l -yscrollcommand bogus]
.l insert 0 foo

With recent 8.6, the red toplevel background is visible before forcing the listbox to appear (e.g. by clicking or resizing); whereas with recent 9.0/9.1, neither the listbox nor the red toplevel background are visible at first.


chrstphrchvz added on 2026-10-08 17:08:33:

While this ticket and [a64a4b331e] (and maybe others) do have similar symptoms and workarounds as [40dc19ee9e], they were observed before Tk Aqua moved away from drawRect:. If the issues in the older tickets still seem present, the exact cause is probably now different.

For the example in this particular ticket, what I notice with recent Tk 9.1 is that, even though the listbox is not visible right away, the error is now generated immediately as expected. So maybe whatever issue which was specific to this ticket, but not others (e.g. [40dc19ee9e]), is fixed in 9.1 (and possibly 9.0), and won’t-fix for 8.6.


serhiy.storchaka added on 2026-10-08 15:38:45:

This looks like the same problem as [40dc19ee9e]: on macOS the widgets created by a script are not displayed, and their display procedures (which call -yscrollcommand) are not run, until an event or update idletasks arrives. Since this was reported for 8.6.12, it is older than the change bisected there. A fix for that ticket should be checked with this script too.


chrstphrchvz added on 2022-04-29 09:51:17:
I have not investigated this deeply, but it seems to be caused by widget windows not being mapped right away, and other widgets are affected (not just listbox).

fvogel added on 2022-04-25 06:07:45:

On Windows, the error triggers:

invalid command name "bogus"
invalid command name "bogus"
    while executing
"bogus 0.0 1.0"
    (vertical scrolling command executed by listbox)

I have no clue why it's not the case on macOS.