繁体   English   中英

无法在使用SCons编译的Mac OSX中关注WxWidgets框架

[英]Cant focus WxWidgets frame in Mac OSX compiled with SCons

我有这个WxWidgets测试源代码编译,运行时,它显示一个简单的框架:

/*
 * hworld.cpp
 * Hello world sample by Robert Roebling
 */

#include "wx-2.8/wx/wx.h"

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

class MyFrame: public wxFrame
{
public:

     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( _T("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, _T("&About...") );
    menuFile->AppendSeparator();
    menuFile->Append( ID_Quit, _T("E&xit") );

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append( menuFile, _T("&File") );

    SetMenuBar( menuBar );

    CreateStatusBar();
    SetStatusText( _T("Welcome to wxWindows!") );
}

void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
    Close(TRUE);
}

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
    wxMessageBox(_T("This is a wxWindows Hello world sample"),
        _T("About Hello World"), wxOK | wxICON_INFORMATION, this);
}

使用这个简单的SCons脚本创建:

env = Environment()
env.ParseConfig('wx-config --cxxflags --libs')

env.Program(target='wxTest/wxTest.exe',source=['src/Wxwidgets.cpp'])

问题是:当我运行它时它不会集中注意力。 我唯一能关注的是左上角的红色,黄色和绿色按钮。 我使用Eclipse作为我的IDE,并在构建它时将scons作为外部工具运行。

那里有人知道我做错了什么吗? 如何让框架集中注意力?

希望有人可以帮助我。

我假设您启动了创建的原始可执行文件? 这在Mac OS X上不起作用,请参阅我的应用程序无法显示在前面!

您必须为您的应用程序创建一个应用程序包才能在Mac OS X上正常运行。我对SCons一无所知,但是wiki可能有帮助吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM