调用 wxSizer.Insert() 隐藏项目
我正在尝试使用以下代码在该 sizer 中的最后一个元素之前将面板插入到 wxBoxSizer 中:
sizer = event.EventObject.Parent.GetSizer()
# Add new panel from xrc
res = xrc.XmlResource('add_panel.xrc')
panel = res.LoadPanel(self, 'panel')
sizer.Insert(len(sizer.Children) -1, panel)
sizer.Layout()
但是当我运行它时,新面板显示正确,但以前是表中最后一个元素的按钮无处可见。有几次我看到该按钮部分被遮挡,很明显它仍然在原来的位置,但隐藏在新面板后面。问题是,调用了 sizer.Layout() 后,为什么它仍然处于原来的位置,我没有做什么来阻止它的不当行为?
I'm trying to insert a panel into a wxBoxSizer before the last element in that sizer using the following code:
sizer = event.EventObject.Parent.GetSizer()
# Add new panel from xrc
res = xrc.XmlResource('add_panel.xrc')
panel = res.LoadPanel(self, 'panel')
sizer.Insert(len(sizer.Children) -1, panel)
sizer.Layout()
But when I run it the new panel shows correctly but the button which was previously the last element in the table is nowhere to be seen. On a couple of occasions I've seen the button partially obscured, so clearly it's still where it was before but hidden behind the new panel. Question is, having called sizer.Layout() why is it still in its old position and what am I not doing that would stop it misbehaving?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的养育方式可能是错误的。某些对象的父对象与实际结构和/或 sizer 不对应。试试这个示例:
Your parenting is probably wrong. Some of the object's parents do not correspond to the actual structure and / or sizers. Try this sample: