Я следовал учебному пособию wxCrafter Hello World: https://wiki.codelite.org/pmwiki.php/Main/WxCrafterHelloWorld
Процесс сборки не показывает ошибок, однако при нажатии «Build-> Run» в CodeLite 13 диалоговое окно не отображается. по какой-то причине ничего не происходит: /
main. cpp:
#include <wx/app.h>
#include <wx/event.h>
#include "MainDialog.h"
#include <wx/image.h>
// Define the MainApp
class MainApp : public wxApp
{
public:
MainApp() {}
virtual ~MainApp() {}
virtual bool OnInit() {
// Add the common image handlers
wxImage::AddHandler( new wxPNGHandler );
wxImage::AddHandler( new wxJPEGHandler );
MainDialog mainDialog(NULL);
mainDialog.ShowModal();
return false;
}
};
DECLARE_APP(MainApp)
IMPLEMENT_APP(MainApp)
MainDialog.h:
#ifndef MAINDIALOG_H
#define MAINDIALOG_H
#include "wxcrafter.h"
class MainDialog : public MainDialogBaseClass
{
public:
MainDialog(wxWindow* parent);
virtual ~MainDialog();
protected:
virtual void OnButtonokButtonClicked(wxCommandEvent& event);
};
#endif // MAINDIALOG_H
MainDialog. cpp:
#include "MainDialog.h"
#include <wx/msgdlg.h>
MainDialog::MainDialog(wxWindow* parent)
: MainDialogBaseClass(parent)
{
}
MainDialog::~MainDialog()
{
}
void MainDialog::OnButtonokButtonClicked(wxCommandEvent& event)
{
::wxMessageBox(_("Hello World"));
}
wxcrafter.h:
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: wxcrafter.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////
#ifndef _WORKSPACE_MEDCEN_PLUS_WXCRAFTER_BASE_CLASSES_H
#define _WORKSPACE_MEDCEN_PLUS_WXCRAFTER_BASE_CLASSES_H
#include <wx/artprov.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/iconbndl.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/xrc/xh_bmp.h>
#include <wx/xrc/xmlres.h>
#if wxVERSION_NUMBER >= 2900
#include <wx/persist.h>
#include <wx/persist/bookctrl.h>
#include <wx/persist/toplevel.h>
#include <wx/persist/treebook.h>
#endif
#ifdef WXC_FROM_DIP
#undef WXC_FROM_DIP
#endif
#if wxVERSION_NUMBER >= 3100
#define WXC_FROM_DIP(x) wxWindow::FromDIP(x, NULL)
#else
#define WXC_FROM_DIP(x) x
#endif
class MainDialogBaseClass : public wxDialog
{
protected:
wxStaticText* m_staticText21;
wxTextCtrl* m_textCtrl23;
wxStaticLine* m_staticLine15;
wxButton* m_buttonOK;
wxButton* m_buttonCancel;
protected:
virtual void OnButtonokButtonClicked(wxCommandEvent& event)
{
event.Skip();
}
public:
wxStaticText* GetStaticText21()
{
return m_staticText21;
}
wxTextCtrl* GetTextCtrl23()
{
return m_textCtrl23;
}
wxStaticLine* GetStaticLine15()
{
return m_staticLine15;
}
wxButton* GetButtonOK()
{
return m_buttonOK;
}
wxButton* GetButtonCancel()
{
return m_buttonCancel;
}
MainDialogBaseClass(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = _("My Dialog"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(500, 300),
long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
virtual ~MainDialogBaseClass();
};
#endif
wxcrafter. cpp:
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: wxcrafter.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////
#include "wxcrafter.h"
// Declare the bitmap loading function
extern void wxC9ED9InitBitmapResources();
static bool bBitmapLoaded = false;
MainDialogBaseClass::MainDialogBaseClass(wxWindow* parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style)
: wxDialog(parent, id, title, pos, size, style)
{
if(!bBitmapLoaded) {
// We need to initialise the default bitmap handler
wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
wxC9ED9InitBitmapResources();
bBitmapLoaded = true;
}
this->SetFocus();
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(mainSizer);
wxBoxSizer* boxSizer19 = new wxBoxSizer(wxHORIZONTAL);
mainSizer->Add(boxSizer19, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));
m_staticText21 = new wxStaticText(
this, wxID_ANY, _("Static Text Label"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
boxSizer19->Add(m_staticText21, 0, wxALL, WXC_FROM_DIP(5));
m_textCtrl23 = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
#if wxVERSION_NUMBER >= 3000
m_textCtrl23->SetHint(wxT(""));
#endif
boxSizer19->Add(m_textCtrl23, 0, wxALL, WXC_FROM_DIP(5));
mainSizer->Add(0, 0, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));
m_staticLine15 =
new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxLI_HORIZONTAL);
mainSizer->Add(m_staticLine15, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));
wxBoxSizer* boxSizer12 = new wxBoxSizer(wxHORIZONTAL);
mainSizer->Add(boxSizer12, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, WXC_FROM_DIP(5));
m_buttonOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
m_buttonOK->SetDefault();
boxSizer12->Add(m_buttonOK, 0, wxALL, WXC_FROM_DIP(5));
m_buttonCancel =
new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
boxSizer12->Add(m_buttonCancel, 0, wxALL, WXC_FROM_DIP(5));
SetName(wxT("MainDialogBaseClass"));
SetSize(wxDLG_UNIT(this, wxSize(500, 300)));
if(GetSizer()) {
GetSizer()->Fit(this);
}
if(GetParent()) {
CentreOnParent(wxBOTH);
} else {
CentreOnScreen(wxBOTH);
}
#if wxVERSION_NUMBER >= 2900
if(!wxPersistenceManager::Get().Find(this)) {
wxPersistenceManager::Get().RegisterAndRestore(this);
} else {
wxPersistenceManager::Get().Restore(this);
}
#endif
// Connect events
m_buttonOK->Connect(
wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainDialogBaseClass::OnButtonokButtonClicked), NULL, this);
}
MainDialogBaseClass::~MainDialogBaseClass()
{
m_buttonOK->Disconnect(
wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainDialogBaseClass::OnButtonokButtonClicked), NULL, this);
}