wxWidgets编程注意事项
来源:互联网 发布:linux 查看mysql进程 编辑:程序博客网 时间:2024/06/07 00:37
1. 在类中定义对象:
{
wxAuiManager m_mgr;
}
编译无法通过,输出类似错误:
demo_demo.o: In function `MyFrame::~MyFrame()':
demo.cpp:(.text+0x6491): undefined reference to `wxAuiManager::UnInit()'
demo.cpp:(.text+0x64a7): undefined reference to `wxAuiManager::~wxAuiManager()'
demo.cpp:(.text+0x64cb): undefined reference to `wxAuiManager::~wxAuiManager()'
原因在于makefile中没有包含库文件(aui),修改为:
g++ -o demo demo_demo.o `wx-config --libs aui,core,base`
搞定!
2. 确定类
window->IsKindOf(CLASSINFO(wxAuiNotebook))
这个类会用先调用:
DECLARE_DYNAMIC_CLASS
IMPLEMENT_DYNAMIC_CLASS
说明自己是什么类
3. 控件布局:
将界面中控件放入wxBoxSizer,所有控件在wxPanel *m_panel中:
wxBoxSizer sizer = new wxBoxSizer(wxVERTICAL);
.....
m_panel->SetAutoLayout( true );
m_panel->SetSizer( mainsizer );
sizer->SetSizeHints( this);
如果是wxSashLayoutWindow:
MyFrame::OnSize()
{
wxLayoutAlgorithm layout;
layout.LayoutFrame(this);
}
当button等空间size变化的时候,如果调用wxFlexGridSizer,变化时:
SetSizeHints()
FitInside()
在sample/scroll中。
OnSize对于控件有影响,比如:
MyFrame::OnSize()
MyPanel::OnSize()
类似于vtable的错误:
wellGrid_wellGrid.o: In function `WellGrid::WellGrid(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)':
wellGrid.cpp:(.text+0x3f2): undefined reference to `vtable for WellGrid'
wellGrid.cpp:(.text+0x3ff): undefined reference to `vtable for WellGrid'
wellGrid_wellGrid.o: In function `WellGrid::WellGrid(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)':
wellGrid.cpp:(.text+0x560): undefined reference to `vtable for WellGrid'
wellGrid.cpp:(.text+0x56d): undefined reference to `vtable for WellGrid'
wellGrid_wellGrid.o: In function `WellGrid::WellGrid()':
wellGrid.cpp:(.text+0x69c): undefined reference to `vtable for WellGrid'
有可能:
1.在*.h头文件中,声明了DECLARE_EVENT_TABLE(),在cpp中没有BEGIN_EVENT_TABLE()。。。
2.如果在*.h中,声明了虚函数,virtual void DrawRowLabels()。。。,没有在cpp中实现,也会出现此类错误。
wxString
1.
char* name = "TestName";
wxString::Format(_T("%s"), name);
执行的时候,会弹出warning,改为:
wxString::FromAscii(name);
it's OK.
- wxWidgets编程注意事项
- wxWidgets学习之注意事项
- wxWidgets:国际化编程
- wxWidgets编程入门
- wxWidgets编程起步
- wxWidgets GUI 编程介绍
- 配置cdt下wxwidgets编程
- dcmtk与wxWidgets混合编程
- dcmtk和wxWidgets混合编程
- Ubuntu下wxWidgets并发编程
- Ubuntu下的wxWidgets编程
- wxWidgets 跨平台 GUI 编程
- 编程注意事项
- 编程注意事项
- 编程注意事项
- 编程注意事项
- 编程注意事项
- 编程注意事项
- C++ 虚函数表解析
- 高性能计算(High Performance Computing)
- swing 面板布局
- 数据结构与算法-开篇
- 实时推送附近的商家优惠信息,Spindle让你在逛街时抓住每一个促销活动
- wxWidgets编程注意事项
- pythonchallenge--1
- Struts2 execute返回值含义
- iis7以fastcgi配置php时出现FastCGI进程意外退出问题解决
- 2012年8月12号
- (win7)IIS7下配置php5.3 (5.3以后的版本只可以使用FastCGI)
- Win7下IIS中以ISAPI的方式配置PHP(只适合PHP5.3以前的版本)
- 用iframe进行表单提交时的若干问题总结
- 51mini板整板测试程序