Skip to content

Commit 78203cd

Browse files
committed
Ensure we have "+" button when adding children to wxTreeCtrl item
The control doesn't update the button itself, even in the recent Windows versions, so do it ourselves. It might be better to use I_CHILDRENCALLBACK and handle TVN_GETDISPINFO, but this looks like a safer change, so do this for now. See wxWidgets#23718, wxWidgets#23734. (cherry picked from commit 3ed273c)
1 parent 8de60c8 commit 78203cd

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

docs/changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ wxMSW:
325325
- Fix position of wxStaticBox label after DPI change (Maarten Bent, #23740).
326326
- Fix background colour of empty cells in wxDataViewCtrl (#23708).
327327
- Fix possible (even if rare) crash in printer progress dialog (#23927).
328+
- Fix "+" button not appearing in wxTreeCtrl after adding a child (#23718).
328329

329330
wxOSX:
330331

src/msw/treectrl.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,15 +1547,9 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent,
15471547
tvIns.item.lParam = (LPARAM)param;
15481548
tvIns.item.mask = mask;
15491549

1550-
// apparently some Windows versions (2000 and XP are reported to do this)
1551-
// sometimes don't refresh the tree after adding the first child and so we
1552-
// need this to make the "[+]" appear
1553-
//
1554-
// don't use this hack below for the children of hidden root nor for modern
1555-
// MSW versions as it would just unnecessarily slow down the item insertion
1556-
// at best
1550+
// Without this, the tree doesn't show a "+" button when we add the first
1551+
// child, at least after removing the children previously (see #23718).
15571552
const bool refreshFirstChild =
1558-
(wxGetWinVersion() < wxWinVersion_Vista) &&
15591553
!IsHiddenRoot(parent) &&
15601554
!TreeView_GetChild(GetHwnd(), HITEM(parent));
15611555

0 commit comments

Comments
 (0)