我正在使用带有wxTL_CHECKBOX样式的wxTreeListCtrl,但由于某种原因,我无法使用鼠标单击来检查复选框,但我可以通过按SPACE来执行此操作。这是正常的,还是我错过了什么?
我的代码:
// .h file
#include <wx/wx.h>
#include <wx/treelist.h>
class MyApp: public wxApp
{
public:
virtual bool OnInit();
};
class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
private:
void OnTreeLeftDown (wxMouseEvent& evt);
private:
enum
{
TreeListId = 1
};
wxTreeListCtrl* m_treeList;
wxDECLARE_EVENT_TABLE();
};
// .cpp file
wxBEGIN_EVENT_TABLE (MyFrame, wxFrame)
wxEND_EVENT_TABLE()
wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame ("Hello World", wxPoint(50, 50), wxSize(600, 400));
frame->Show (true);
return true;
}
MyFrame::MyFrame (const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame (NULL, wxID_ANY, title, pos, size)
{
m_treeList = new wxTreeListCtrl (this, TreeListId, wxPoint (10, 10), wxSize(600, 400), wxTL_CHECKBOX);
m_treeList->AppendColumn (L"Item Name");
m_treeList->AppendItem (m_treeList->GetRootItem(), L"Test");
m_treeList->AppendItem (m_treeList->GetRootItem(), L"Another one");
CenterOnScreen ();
}
答案 0 :(得分:0)
正如有人在wxWidgets论坛中指出的那样,这是3.0.0中的一个错误 这是bug url http://trac.wxwidgets.org/ticket/15731