How do I use wxformbuilder inherited class?

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

How do I use wxformbuilder inherited class?

Post by philjynx »

This is what is generated (at the moment)
The constructor is expecting something from me (wxWindow* parent) but I don't know how or what to put there.

Code: Select all

#ifndef __FkF1__
#define __FkF1__

/**
@file
Subclass of F1, which is generated by wxFormBuilder.


*/
#include "Fk.h"
//// end generated include
/** Implementing F1 */
class FkF1 : public F1
{
	protected:
		// Handlers for F1 events.
		void DoClose( wxCloseEvent& event );
	public:
		/** Constructor */
		FkF1( wxWindow* parent );
	//// end generated class members
};
#endif // __FkF1__
My problem is, I have no idea what to do with it in my code which looks like this:

Code: Select all

#include "FkF1.cpp"
class MyApp : public wxApp
{
public:
    virtual bool OnInit();
};


wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
   
    FkF1 *frame = new FkF1(I HAVE NO IDEA WHAT TO PUT HERE);
    frame->Show(true);
    return true;
}
User avatar
T-Rex
Moderator
Moderator
Posts: 1248
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: How do I use wxformbuilder inherited class?

Post by T-Rex »

Code: Select all

FkF1 *frame = new FkF1(NULL);
?
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: How do I use wxformbuilder inherited class?

Post by philjynx »

I tried NULL, right now I don't recall the compiler error that gave rise to.
I'll try that again and post back.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: How do I use wxformbuilder inherited class?

Post by philjynx »

The error I get is
undefined reference to `MyFrame1::MyFrame1(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long)'

The generated constructor;

Code: Select all

public:
		
		MyFrame1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
		wxAuiManager m_mgr;
		
		~MyFrame1();
		
The generated subclass:

Code: Select all

	public:
		/** Constructor */
		TestProjMyFrame1( wxWindow* parent );
	//// end generated class members
I wouldn't be asking if I understood this!
User avatar
T-Rex
Moderator
Moderator
Posts: 1248
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: How do I use wxformbuilder inherited class?

Post by T-Rex »

Can you post the implementation of MyFrame1::MyFrame1(...) constructor?
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: How do I use wxformbuilder inherited class?

Post by philjynx »

Sorry, no, I can't, since I posted I have trashed that file and broken my wxformbuilder install.
If I get back to a position where I can build and run formbuilder & then back to that problem I'll return, but I wouldn't hold your breath. Thank you for trying to help.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: How do I use wxformbuilder inherited class?

Post by philjynx »

Now that I have a working system again.....
On reading the generated code from wxFormbuilder (which uses the 'discouraged' Connect(blahdiblah) function) I've fathomed out how to sub-class, the inherited class files that wxFormBuilder generates and I'm in buisiness. Thank you for your help.
Post Reply