Author Topic: [resolved][wxSmith] How to create a Frame  (Read 3716 times)

Offline Didier69

  • Single posting newcomer
  • *
  • Posts: 8
    • blog
[resolved][wxSmith] How to create a Frame
« 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.
« Last Edit: June 16, 2006, 11:18:41 pm by Didier69 »

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: [wxSmith] How to create a Frame
« Reply #1 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;
}

Offline Didier69

  • Single posting newcomer
  • *
  • Posts: 8
    • blog
Re: [wxSmith] How to create a Frame
« Reply #2 on: June 16, 2006, 11:18:22 pm »
cool it works thanks !