Først en udgave af programmet der kan oversættes:
#include "wx/wx.h"
class MyApp:
public wxApp {
virtual bool OnInit();
};
class MyFrame:
public wxFrame {
public:
wxString T;
wxPoint P;
wxSize S;
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
enum {
ID_Quit = 1,
ID_About,
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame("Hello World", wxPoint(50, 50), wxSize(450, 340));
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) :
wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append(ID_About, "&About");
menuFile->AppendSeparator();
menuFile->Append(ID_Quit, "E&xit");
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, "&Filer");
SetMenuBar(menuBar);
CreateStatusBar();
SetStatusText("Hello World in status bar ");
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) {
Close(TRUE);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) {
wxMessageBox("Hello World!", "About Hello World", wxOK | wxICON_INFORMATION, this);
}
Så skal du lave et nyt Tool:
Tools-> Setup, tryk på New
Program:
bcc32
Arguments:
@D:\\Program\\wxWindows-2.4.2\\src\\msw\\wxw32d.cfg -tW -v -Od -ID:\\Program\\wxWindows-2.4.2\\include\\ $FFE$ D:\\Program\\wxWindows-2.4.2\\lib\\wx24ds_bcc.lib
Det er én linie, du skal rette stierne,
Directory:
$FP$
MenuText:
WxWin
Så trykker du på Apply.
Så burde du kunne kompiler ved at vælge WxWin fra Tools menuen.
Du kan mappe WxWin tool'et til en tast med Options->Keyboard.