# Top-level sizer? return window's sizer
if xxx.isSizer and isinstance(parentWin, wxWindow):
return parentWin.GetSizer()
- elif xxx.__class__ in [xxxStatusBar, xxxMenu, xxxMenuItem, xxxSeparator]: return None
+ elif xxx.__class__ in [xxxMenu, xxxMenuItem, xxxSeparator]: return None
elif xxx.__class__ in [xxxToolBar, xxxMenuBar]:
# If it's the main toolbar or menubar, we can't really select it
if xxx.parent.__class__ == xxxFrame: return None
# First window is controld
return parentWin.GetChildren()[self.ItemIndex(item)+1]
# Otherwise get parent's object and it's child
- child = parentWin.GetChildren()[self.ItemIndex(item)]
+ child = parentWin.GetChildren()[self.WindowIndex(item)]
# Return window or sizer for sizer items
if child.GetClassName() == 'wxSizerItem':
if child.IsWindow(): child = child.GetWindow()
elif child.IsSizer():
child = child.GetSizer()
- # Test for notebook sizers (deprecated)
- if isinstance(child, wxNotebookSizer):
- child = child.GetNotebook()
return child
def OnSelChanged(self, evt):
return
# Get window/sizer object
obj = self.FindNodeObject(item)
- if not obj: return
+ if not obj:
+ if g.testWin.highLight: g.testWin.highLight.Remove()
+ return
pos = self.FindNodePos(item, obj)
size = obj.GetSize()
# Highlight
def OnCloseTestWin(self, evt):
self.CloseTestWindow()
+ # Return index in parent, for real window children
+ def WindowIndex(self, item):
+ n = 0 # index of sibling
+ prev = self.GetPrevSibling(item)
+ while prev.IsOk():
+ # MenuBar is not a child
+ if not isinstance(self.GetPyData(prev), xxxMenuBar):
+ n += 1
+ prev = self.GetPrevSibling(prev)
+ return n
+
# Return item index in parent
def ItemIndex(self, item):
n = 0 # index of sibling