wxListCtrl items become invisible after calling SetColumnWidth and resizing. (Issue #26394)

18 views
Skip to first unread message

dsa-t

unread,
Apr 19, 2026, 10:02:15 AM (5 days ago) Apr 19
to wx-...@googlegroups.com, Subscribed
dsa-t created an issue (wxWidgets/wxWidgets#26394)

Description

  1. Add the following to listtest.cpp:
        m_listCtrl->Bind(wxEVT_SIZE,
            [this](wxSizeEvent& aEvt)
            {
                const int width = std::max(m_listCtrl->GetClientSize().GetWidth() - 2, 20);
                m_listCtrl->SetColumnWidth(0, width);

                aEvt.Skip();
            });
  1. Decrease the frame's height until the vertical scrollbar appears
  2. Scroll down the list
  3. Increase the frame's height until the vertical scrollbar disappears
  4. The rendering is now broken (items only redraw when hovered)

https://github.com/user-attachments/assets/c8e8eff0-f9b1-4dcd-a987-2c0595b6ca91

Platform and version information

  • wxWidgets version you use: wx 3.3.3 (master)
  • wxWidgets port you use: wxMSW
  • OS and its version: Windows 11 Pro 25H2

KiCad report: https://gitlab.com/kicad/code/kicad/-/work_items/23986


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26394@github.com>

VZ

unread,
Apr 19, 2026, 4:56:38 PM (5 days ago) Apr 19
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26394)

Thanks, I can see this, even under Windows 10. Will look.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26394/4276801410@github.com>

VZ

unread,
Apr 19, 2026, 5:06:49 PM (5 days ago) Apr 19
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26394)

This is nasty because it looks like a native LISTVIEW bug, i.e. while I didn't try doing it yet, I'm almost sure it could be reproduced just using Win32 API because I still see it even when removing our wxEVT_PAINT handler completely, resizing the column while in WM_SIZE handler seems to break some internal control logic for determining the dirty region.

Also, I can get rid of it by not enabling LVS_EX_DOUBLEBUFFER on the control, but this results in display glitches when resizing, just as indicated by the comment, so this is not a solution either.

However, I can propose the workaround: don't resize the columns from wxEVT_SIZE handler itself, but a bit later, i.e. do this:

    m_listCtrl->Bind(wxEVT_SIZE,
        [this](wxSizeEvent& aEvt)
        {
            m_listCtrl->CallAfter([this] {
                
const int width = std::max(m_listCtrl->GetClientSize().GetWidth() - 2, 20);
                m_listCtrl->SetColumnWidth(0
, width);
            });

            aEvt.Skip();
            });

instead of what you did. In principle, we could even do it ourselves from inside SetColumnWidth() but I don't know if it's worth it, maybe just documenting this as wxMSW limitation with this workaround would be enough?

Anyhow, the real question is whether the workaround also works for KiCad and not just the example?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26394/4276820082@github.com>

Reply all
Reply to author
Forward
0 new messages