我有 wxScrolledWindow 的问题。
我有一个 ScrolledWindow 持有一个 wxListBox。
有效的行为:
在将项目添加到列表框时,滚动条最终会出现。
失败的行为:
wxListBox 有一些项目。当我减小 ScrolledWindow 的大小以使某些项目被遮挡时,滚动条无法出现。
// split window into 2
wxBoxSizer *sizermain = new wxBoxSizer(wxVERTICAL);
wxSplitterWindow *splittermain = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE);
splittermain->SetSashGravity(0.5);
splittermain->SetMinimumPaneSize(20);
sizermain->Add(splittermain, 1,wxEXPAND,0);
this->SetSizer(sizermain);
// split left window into 2
wxSplitterWindow * splitterleft = new wxSplitterWindow(splittermain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE);
splitterleft->SetSashGravity(0.5);
splitterleft->SetMinimumPaneSize(20);
wxBoxSizer * sizerleft = new wxBoxSizer(wxHORIZONTAL);
sizerleft->Add(splitterleft, 1, wxEXPAND, 0);
// split right window into 2
wxSplitterWindow * splitteright = new wxSplitterWindow(splittermain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE);
splitteright->SetSashGravity(0.5);
splitteright->SetMinimumPaneSize(20);
wxBoxSizer * sizerright = new wxBoxSizer(wxHORIZONTAL);
sizerright->Add(splitteright, 1, wxEXPAND, 0);
wxScrolledWindow *tlpnl = new wxScrolledWindow(splitterleft, wxID_ANY);
wxListBox *tlcalls = new wxListBox(tlpnl, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_EXTENDED);
wxBoxSizer *tlsizer = new wxBoxSizer(wxVERTICAL);
tlsizer->Add(tlcalls, 1,wxEXPAND,0);
tlpnl->SetSizer(tlsizer);
wxScrolledWindow *blpnl = new wxScrolledWindow(splitterleft, wxID_ANY);
wxListBox *blcontacts = new wxListBox(blpnl, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_EXTENDED);
wxBoxSizer *blsizer = new wxBoxSizer(wxVERTICAL);
blsizer->Add(blcontacts, 1,wxEXPAND,0);
blpnl->SetSizer(blsizer);
wxScrolledWindow *trpnl = new wxScrolledWindow(splitteright, wxID_ANY);
inCall = new wxListBox(trpnl, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_EXTENDED);
wxBoxSizer *trsizer = new wxBoxSizer(wxVERTICAL);
trsizer->Add(inCall, 1,wxEXPAND,0);
trpnl->SetSizer(trsizer);
wxScrolledWindow *brpnl = new wxScrolledWindow(splitteright, wxID_ANY);
wxTextCtrl *brtext = new wxTextCtrl(brpnl, wxID_ANY);
wxBoxSizer *brsizer = new wxBoxSizer(wxVERTICAL);
brsizer->Add(brtext, 1,wxEXPAND,0);
brpnl->SetSizer(brsizer);
splittermain->SplitVertically(splitterleft, splitteright);
splitterleft->SplitHorizontally(tlpnl, blpnl);
splitteright->SplitHorizontally(trpnl, brpnl);