At its most basic, I am trying to get a button click on my main wxWidget form to launch another form.
I can do that if I put the following in the derived class from wxFormBuilder:
I haven't even begun to look at how my main app is going to know about values changed in child forms.
Code: Select all
.....
void stestMyFrame1::OnOtherForm( wxCommandEvent& event )
{
stestMyFrame2* subFrame = new stestMyFrame2(NULL);
subFrame->show(true);
}
There are two problems with this.
1 It depends on #include "stestMyFrame2.h" which I put at the top of this generated file.
When you "generate inherited class" (in wxFormBuilder), the #include gets wiped out.
My other code (in the block above) is left intact, but is unusable because the dependency has been broken.
2 When it is in a functioning state, you can click and create an infinite number of instances of subform.
So, clearly my approach is unworkable.
There appears not to be a ShowModal available, that would enforce only displaying one instance of a form.
I've tried to get to grips with the part of the manual that deals with event handling.
Events and Event Handling.
One of the many hurdles that I've fallen on is this:
"Next the event table must be defined and, as with any definition, it must be placed in an implementation file. The event table tells wxWidgets how to map events to member functions and in our example it could look like this:"
particularly "...it must be placed in an implementation file."
What implementation file?
I'm not looking for a course in C++ here, but honestly, I'm finding this extremely hard to follow - is there an example of all those fragments stitched together into a whole that can be perused and digested?
I imagine that as I am trying to use inherited classes from wxFormBuilder that that is obfuscating this even more for me.
I do a lot of coding for teensy - with a great deal of event handling - it's really easy, as was Delphi.
So, I understand the concepts, but I'm not following how to do this with wxWidgets.
Help!