wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.21k stars 509 forks source link

ultimatelistctrl.py ULC_AUTO_CHECK_PARENT not handled #2516

Closed da-dada closed 3 months ago

da-dada commented 4 months ago

Operating system: wxPython version & source: Python version & source:

Description of the problem: style ULC_AUTO_CHECK_PARENT is not handled

method CheckItem should be modified (see if self.HasAGWFlag(ULC_AUTO_CHECK_PARENT etc) (click to expand) ```python def CheckItem(self, item, checked=True, sendEvent=True): """ Actually checks/uncheks an item, sending (eventually) the two events ``EVT_LIST_ITEM_CHECKING`` / ``EVT_LIST_ITEM_CHECKED``. :param `item`: an instance of :class:`UltimateListItem`; :param `checked`: ``True`` to check an item, ``False`` to uncheck it; :param `sendEvent`: ``True`` to send a {UltimateListEvent}, ``False`` otherwise. :note: This method is meaningful only for checkbox-like and radiobutton-like items. """ # Should we raise an error here?!? if item.GetKind() == 0 or not item.IsEnabled(): return if sendEvent: parent = self.GetParent() le = UltimateListEvent(wxEVT_COMMAND_LIST_ITEM_CHECKING, parent.GetId()) le.m_itemIndex = item._itemId le.m_item = item le.SetEventObject(parent) if parent.GetEventHandler().ProcessEvent(le): # Blocked by user return item.Check(checked) self.SetItem(item) self.RefreshLine(item._itemId) if self.HasAGWFlag(ULC_AUTO_CHECK_PARENT) and\ item.GetKind() == 1: # check box like item col = item.GetColumn() info = self.GetColumn(col) if self.GetCheckedItemCount(col) == self.GetItemCount(): info.Check(True) else: info.Check(False) self.SetColumn(col, info) if not sendEvent: return le = UltimateListEvent(wxEVT_COMMAND_LIST_ITEM_CHECKED, parent.GetId()) le.m_itemIndex = item._itemId le.m_item = item le.SetEventObject(parent) parent.GetEventHandler().ProcessEvent(le) ```