Hello everyone,
I am using a CustomTreeCtrl, and I have noticed that if I use the SetWindow method of a GenericTreeItem, the window isn't hidden if any of the parents are collapsed. Is this a bug or do I just not understand why this might be expected?
I noticed in CustomTreeCtrl's DoAddItem there is this:
if wnd is not None:
self._hasWindows = True
self._itemWithWindow.append(item)
Now, when an item is collapsed, HideWindows is called, which iterates over everything in self._itemWithWindow and hides the windows. However, when an the window is set via SetWindow on the GenericTreeItem, the GenericTreeItem instance never gets added to the _itemWithWindow list in the CustomTreeCtrl. This (I believe) causes it to not be hidden when any upper parent is collapsed. It doesn't appear that a GenericTreeItem has access directly to the CustomTreeCtrl to add itself to this list, so I am not sure what a solution would be. I figured if there was a SetItemWindow on the CustomTreeCtrl that could work just fine, but there only appears to be a GetItemWindow.
Any ideas on how to have windows added to items after creation behave properly? The easiest solution I see would be to create a SetItemWindow which calls the items SetWindow and then adds the window to the _itemWithWindow list, though it would be optimal if SetWindow could be used as well. Attached is a runnable demo of this issue.
Thanks again Andrea for the great control, by the way!
- Mike
ctwndnohide.py (679 Bytes)