Reputation: 1830
Every time I use wxFormBuilder I face with a lot of configuration related to project. Such as, name, path, embedded_files_path, file etc. When I generate code the name of the frame will be the name of the base class, derived class has the name formatted like ${PROJECT_NAME}${FRAMENAME}
or something like that. I prefer base classes have different names, derived classes have the names of the frames.
I do not know how I am supposed to use wxFB. What is the best practice to generate code? Should I simple copy paste or use code generation? How can I use custom controls? When I create custom controls, which wxFB variables should I use for defining code-generation of the control? Could you illuminate me about all of these stuff? Thank you very much. :)
Upvotes: 1
Views: 2614
Reputation: 6550
I do not know how I am supposed to use wxFB. What is the best practice to generate code? Should I simple copy paste or use code generation?
wxFB relies on principle of inheritance so the it generates two sets of files, Base class and Child class (inheriting from base class). Then it expects you to modify ONLY inherited class files and every time you regenerate codes it overwrites the base class without touching the latter.
That being said, you can find tutorials and videos on internet by simple search.
Note: I used wxFB long ago, so there might be slight change as to how it works. I currently use wxCrafter that comes with CodeLite. You might need to take a look at it.
Upvotes: 0
Reputation: 242
wxFormBuilder is a powerful tool, i have grown quite fond of it. There are certainly many different ways to use it. Anyhow, here is my best practice:
Create a FB-Project, set the name & file to something like
ILikeFBView
and store it to a File with the same name
ILikeFBView.fbp
Do Everything that is supported by FB (layout, button-events, ...)
Generate the Code, This should crate ILikeFBView.h,
ILikeFBView.cpp
Never modify these files directly!
Create a derived class class ILikeFB: public ILikeFBView
and implement all business-logic here.
This approach takes a bit of setup - but the big advantage is FB can be used (repeatedly) to modify the layout without touching the code implementing the logic
Upvotes: 2