我使用C ++处理WxWidgets应用程序时遇到了问题,我遇到了一种情况,我的应用程序可能会根据用户事件在UI上给出两个或三个按钮。当三个对齐方式适当但按钮减少时到2的对齐会消失。
示例代码:
wxSizer* pMainHSizer = new wxBoxSizer(wxHORIZONTAL);
m_pCancel = new wxFlatButton(panel, ID_CANCEL, cancellabel);
m_pYes = new wxFlatButton(panel, wxID_YES, yeslabel);
m_pNo = new wxFlatButton(panel, wxID_NO, nolabel);
m_pYes->SetDefault();
pMainHSizer->Add(m_pYes, 0, wxALL, 5);
pMainHSizer->Add(20, -1);
pMainHSizer->Add(m_pNo, 0, wxALL, 5);
pMainHSizer->Add(20, -1);
pMainHSizer->Add(m_pCancel, 0, wxALL, 5);