Code::Blocks Forums

User forums => Help => Topic started by: Didier69 on June 16, 2006, 05:52:31 pm

Title: [resolved][wxSmith] How to create a Frame
Post by: Didier69 on June 16, 2006, 05:52:31 pm
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.
Title: Re: [wxSmith] How to create a Frame
Post by: byo on June 16, 2006, 09:44:34 pm
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

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;
}
Title: Re: [wxSmith] How to create a Frame
Post by: Didier69 on June 16, 2006, 11:18:22 pm
cool it works thanks !