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)
- 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)
- 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
- 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... ?)
Hi Vadim, others.
Using wxWidgets f3aa944 from git on Mac Tahoe 26.2
wxTreeCtrl::SetStateImages()with awxVector<wxBitmapBundle>with 16x16 (in red) and 32x32 (in green for test) wxBitmapswxTreeCtrl::SetItemState()for each Child Item (for test)wxWithImagesfunction:void WXHandleDPIChanged(wxDPIChangedEvent& event){if ( HasImages() )OnImagesChanged();event.Skip();}HasImages()returns false and hence virtualwxGenericTreeCtrl::OnImagesChanged()is never called, which should handle DPI changes for the state images bym_imagesState.GetUpdatedImageListFor(this)wxTreeCtrl::SetStateImages(BitmapBundleList)I also callwxTreeCtrl::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 ImageswxWithImagesto judge thatwxTreeCtrlwill use OnImagesChanged() to update it State Images... ?)