Why does sizer.GetChildren return SizerItems instead of widgets?

已查看 107 次
跳至第一个未读帖子

Mike Driscoll

未读,
2012年8月22日 09:24:172012/8/22
收件人 wxpytho...@googlegroups.com
Hi,

I was attempting to help someone on StackOverflow yesterday (see http://stackoverflow.com/q/12031522/393194) and they were trying to get the children of a BoxSizer using its GetChildren method. This returns a list of SizerItems instead of the actual widgets though. Is there a way to get the widgets like you do when you call a panel's GetChildren method?

- Mike

Cody

未读,
2012年8月22日 09:32:322012/8/22
收件人 wxpytho...@googlegroups.com
Hi,
Because the 'children' of a sizer may not all be windows/widgets. They
may be other sizers, spacers, ect...

Each of the SizerItem's has a reference to the Window object it
manages if it has one. Use either the Window property or GetWindow
method.


Cody

Mike Driscoll

未读,
2012年8月22日 10:32:162012/8/22
收件人 wxpytho...@googlegroups.com

GetWindow? I knew I should have tried that, but I figured that would just return the frame or panel. Thanks Cody!

- Mike
回复全部
回复作者
转发
0 个新帖子