StaticBox with children

In 2.9 controls within a staticbox can be children of it and no longer need to be siblings.

When I do this (see attached) then tab traversal does no longer work - or am I doing something wrong?

Werner

staticboxtest.py (1.22 KB)

It looks like the static box needs to have the control container code added to it so it can handle the tab traversal events. Please create a trac ticket about this.

BTW, you have some other problems in your code. You are adding the items that are children of the static box to the panel's sizer. You should treat the static box (for layout related things) as if it was just another panel. IOW, it should have it's own sizer for managing its own children.

Also the wxStaticBoxSizer probably shouldn't be used in this case. Its purpose is to manage the size of the box so it fits around the children of the sizer. Since the box should have its own sizer assigned to it, and since you can then just add the box directly to the parent's sizer, then the wxStaticBoxSizer just becomes excess baggage.

···

On 9/21/11 10:45 AM, werner wrote:

In 2.9 controls within a staticbox can be children of it and no longer
need to be siblings.

When I do this (see attached) then tab traversal does no longer work -
or am I doing something wrong?

--
Robin Dunn
Software Craftsman

In 2.9 controls within a staticbox can be children of it and no longer
need to be siblings.

When I do this (see attached) then tab traversal does no longer work -
or am I doing something wrong?

It looks like the static box needs to have the control container code added to it so it can handle the tab traversal events. Please create a trac ticket about this.

Will do - but see below.

BTW, you have some other problems in your code. You are adding the items that are children of the static box to the panel's sizer. You should treat the static box (for layout related things) as if it was just another panel. IOW, it should have it's own sizer for managing its own children.

Also the wxStaticBoxSizer probably shouldn't be used in this case. Its purpose is to manage the size of the box so it fits around the children of the sizer. Since the box should have its own sizer assigned to it, and since you can then just add the box directly to the parent's sizer, then the wxStaticBoxSizer just becomes excess baggage.

If I change it and treat SB like a panel then I tab traversal works, but the static text box label is not shown.

Assuming that my code is ok this time then I think I should probably report this one and maybe an error/warning/exception should be thrown if one keeps using the SB sizer.

Or should I create two different tickets?

Werner

staticboxtest.py (1.34 KB)

···

On 09/21/2011 08:28 PM, Robin Dunn wrote:

On 9/21/11 10:45 AM, werner wrote:

In 2.9 controls within a staticbox can be children of it and no longer
need to be siblings.

When I do this (see attached) then tab traversal does no longer work -
or am I doing something wrong?

It looks like the static box needs to have the control container code added to it so it can handle the tab traversal events. Please create a trac ticket about this.

Done - Ticket #13510

BTW, you have some other problems in your code. You are adding the items that are children of the static box to the panel's sizer. You should treat the static box (for layout related things) as if it was just another panel. IOW, it should have it's own sizer for managing its own children.

Also the wxStaticBoxSizer probably shouldn't be used in this case. Its purpose is to manage the size of the box so it fits around the children of the sizer. Since the box should have its own sizer assigned to it, and since you can then just add the box directly to the parent's sizer, then the wxStaticBoxSizer just becomes excess baggage.

I tried this but then the SB label doesn't show, mentioned it in the above ticket and provided two different test files.

Werner

···

On 09/21/2011 08:28 PM, Robin Dunn wrote:

On 9/21/11 10:45 AM, werner wrote: