A well-designed application will have its widgets organized neatly so that a user can easily access them. To accomplish this, we can use sizers to organize widgets, making them easier to locate and use. However, there are more methods of organization beyond sizers. This article will introduce you to methods of organization that work in conjunction with sizers and such, so you can organize your widgets even more, further benefitting those who use your applications.
One thing to note here is that the wxStaticBox is not the parent of our wxButton. If you set it as the parent of anything, your application will crash, and that's not a key ingredient for a healthy application.
If we want to organize controls in a wxStaticBox, we can use wxStaticBoxSizer, which works like wxBoxSizer. This can be hooked up to our wxStaticBox. We'll add another button to our box, though, and since this method is not too friendly with absolute positioning, we'll use wxBoxSizer. We'll create two of these to center everything:
This article has shown you that, beyond using simple sizers, there are additional ways to organize the controls in your application, giving the user more control over what he or she sees, which makes him or her appreciate your application more. Organization can be done in a variety of ways, including the ones that this article has outlined: switching panels, using tabs, using a list, using a drop-down list and using a wxStaticBox to organize closely related widgets in your application. Ease-of-use must be considered in any application, and this article has given you some tools to use in the process.