State images for wxTreeCtrl not changing when no images are used (Issue #26059)

10 views
Skip to first unread message

Henk Demper

unread,
Dec 30, 2025, 4:30:51 PM (17 hours ago) Dec 30
to wx-...@googlegroups.com, Subscribed
HenkDemper created an issue (wxWidgets/wxWidgets#26059)

Hi Vadim, others.

Using wxWidgets f3aa944 from git on Mac Tahoe 26.2

  • I'm using wxTreeCtrl with only State Images by wxTreeCtrl::SetStateImages() with a wxVector<wxBitmapBundle> with 16x16 (in red) and 32x32 (in green for test) wxBitmaps
  • I set states with wxTreeCtrl::SetItemState() for each Child Item (for test)
  • I start the application on a HDPI display and it will use the 32x32 Bitmaps (1st image with 32x32 green state images)
HDPI.Ok.png (view on web)
  • I then drag the application to a non-HDPI display and it will still use the 32x32 Bitmaps, which are now too big (2nd image with large 32x32 green state images)
Non-HDPI.NG.png (view on web)
  • In debugger with wxWidgets source I think I traced it down to the wxWithImages function:

void WXHandleDPIChanged(wxDPIChangedEvent& event)
{
if ( HasImages() )
OnImagesChanged();
event.Skip();
}

  • Because I only set State Images, HasImages() returns false and hence virtual wxGenericTreeCtrl::OnImagesChanged() is never called, which should handle DPI changes for the state images by m_imagesState.GetUpdatedImageListFor(this)
  • If during initialisation apart from wxTreeCtrl::SetStateImages(BitmapBundleList) I also call wxTreeCtrl::SetImages(BitmapBundleList) (even though I don't use any Item Images), then the State Images will become DPI-aware correctly as expected (3rd images with 16x16 red state images)
    wxGenericTreeCtrl::OnImagesChanged() will be used to handle DPI changes for State Images
Non-HDPI.Ok.png (view on web)
  • So there is a workaround, but it might be worthwhile fixing ? (although it might be difficult in wxWithImages to judge that wxTreeCtrl will use OnImagesChanged() to update it State Images... ?)


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/26059@github.com>

Reply all
Reply to author
Forward
0 new messages