User forums > Help

[resolved][wxSmith] How to create a Frame

(1/1)

Didier69:
Ok, I understand how to play with Panel. I created a frame too, but how I can launch this frame in my so little main.cpp ? Any example I can see somewhere ?

Regards.

byo:
If you have created wxWidgets app using wxSmith project wizard, main resource may be configured inside menu: wxSmith -> Configure wxSmith for current project.

If not, there's application class required:

app.h:


--- Code: (cpp) ---#ifndef APP_H
#define APP_H

#include <wx/wxprec.h>

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

class MyApp : public wxApp
{
public:
virtual bool OnInit();
};

#endif // APP_H

--- End code ---

app.cpp:

--- Code: (cpp) ---#include "app.h"
#include "yourframe.h"

IMPLEMENT_APP(MyApp);

bool MyApp::OnInit()
{
FrameClass* frame = new FrameClass(0);
if ( !frame ) return false;
frame->Show();
return true;
}

--- End code ---

Didier69:
cool it works thanks !

Navigation

[0] Message Index

Go to full version