Using the source code

How do you use source code generated by wxGlade? Basically in two ways.

You can safely edit the source code of the generated class. This is because wxGlade marks the untouchable code with the special comments “begin wxGlade” and “end wxGlade”.

So you can edit all you need outside these two tags. When you make changes in your forms, a new code generation will not modify the user code.

The other way is to generate the class with wxGlade in a file (e.g. myFormUI.xxx) and subclass it in another file (e.g. myForm.xxx). This gives you the psychological advantage that there is a file for you and one for wxGlade :-) . That way if you are stuck writing messy code you can erase your entire source file.

There is an annoying problem in wxWidgets: you can put widgets directly on a wxFrame or in a wxPanel that belongs to the wxFrame. If you choose the first option, in Microsoft Windows the frame looks quite odd.

Since wxGlade doesn't automatically generate a wxPanel within a wxFrame, a good way of working is to design a wxPanel with wxGlade (by choosing "dialog" in the main toolbar) and import it into the wxFrame. This gives you the double advantage of separating code and UI, as well as preserving the wxFrame-wxPanel-Widgets structure.