I tried SetClientSize and SetSize methods, but window still has the same size:
Code: Select all
MainWindow::MainWindow(wxWindow* parent, const std::shared_ptr<SharingManager>& sharingManager, const std::shared_ptr<UiAgentMasterBridge>& agentBridge) :
wxCustomFrame(parent, wxT(""), wxDEFAULT_FRAME_STYLE & ~wxMAXIMIZE_BOX & ~wxMINIMIZE_BOX & ~wxRESIZE_BORDER),
m_sharingManager(sharingManager),
m_allowSharing(false),
m_hasDefaultShares(false),
m_uiAgentBridge(agentBridge)
{
Init();
SetTitle("Title");
SetMinClientSize(FromDIP(wxSize(500, 300)));
SetMaxClientSize(FromDIP(wxSize(700, 700)));
//SetClientSize(FromDIP(wxSize(700, 700)));
SetBackgroundColour(StylesFactory::BackgroundColor);
SetForegroundColour(StylesFactory::ForegroundColor);
CenterOnScreen();
UpdateLayout();
Bind(wxEVT_CLOSE_WINDOW, &MainWindow::OnExit, this);
Bind(wxEVT_SIZE, &MainWindow::OnSize, this);
Bind(wxEVT_BUTTON, &MainWindow::OnCancel, this, wxID_CANCEL);
}
wxCustomPanel* MainWindow::CreateContent()
{
auto contentPanel = new wxCustomPanel(m_frameContent, FromDIP(wxSize(GetSize().GetWidth(), GetSize().GetHeight())));
contentPanel->SetBackgroundColour(StylesFactory::BackgroundColor);
auto mainSizer = new wxBoxSizer(wxVERTICAL);
auto messageSizer = new wxBoxSizer(wxHORIZONTAL);
auto aboutBoxSizer = new wxBoxSizer(wxVERTICAL);
auto buttonSizer = new wxBoxSizer(wxVERTICAL);
auto readyTechTitle = new wxStaticText(contentPanel, wxID_ANY, wxT("ReadyTech"));
readyTechTitle->SetFont(READY_TECH_LABEL_FONT);
auto readyTechMsgVertSizer = new wxBoxSizer(wxVERTICAL);
auto readyTechMessageSizer = new wxBoxSizer(wxHORIZONTAL);
readyTechMsgVertSizer->Add(readyTechTitle, 1, wxCENTER | wxALL, FromDIP(20));
m_aboutMessage = new wxStaticText(contentPanel, wxID_ANY, _(READY_TECH_TEXT_MSG1));
m_readyTechLink = new wxHyperlinkCtrl(contentPanel, wxID_ANY, _(READY_TECH_TEXT_LINK), "https://readytech.com/");
m_contactUsMessage = new wxStaticText(contentPanel, wxID_ANY, _(READY_TECH_TEXT_MSG2));
readyTechMessageSizer->Add(m_aboutMessage, wxSizerFlags(0).Expand());
this->SetClientSize(FromDIP(wxSize(700, 700))); // setting new size here
int readyTechLinkBorder = 20;
readyTechMessageSizer->Add(m_readyTechLink, wxSizerFlags(0).Expand());
readyTechMessageSizer->Add(new wxStaticText(contentPanel, wxID_ANY, "."), wxSizerFlags(0).Expand());
readyTechMsgVertSizer->Add(readyTechMessageSizer, wxSizerFlags().Expand().Align(wxCENTER).Border(wxLEFT | wxRIGHT, FromDIP(20)));
readyTechMsgVertSizer->Add(m_contactUsMessage, wxSizerFlags(1).Expand().Border(wxRIGHT | wxLEFT, FromDIP(20)).Align(wxCENTER));
aboutBoxSizer->Add(readyTechMsgVertSizer, 0, wxDOWN | wxRIGHT | wxEXPAND, FromDIP(15));
m_readyTechCopyrightLabel = new wxStaticText(contentPanel, wxID_ANY, wxString::Format(_(READY_TECH_COPYRIGHT_MSG), COMPUTE_BUILD_YEAR));
m_readyTechCopyrightLabel->Wrap(-1);
aboutBoxSizer->Add(m_readyTechCopyrightLabel, 1, wxCENTER);
messageSizer->Add(aboutBoxSizer, 1, wxALIGN_CENTER_VERTICAL);
mainSizer->Add(messageSizer, 1, wxALIGN_CENTER_HORIZONTAL);
auto buttonCancel = wxUtils::CreateTransparentButton(contentPanel, wxID_CANCEL, FromDIP(ButtonSize), GetFont(), wxColour(216, 30, 91), nullptr, _("btn.Close"), wxColour(216, 30, 91, 191),
wxColour(182, 25, 77), wxALIGN_CENTER);
buttonSizer->Add(buttonCancel, wxSizerFlags(0).Border(wxALL, FromDIP(DefaultBorder)).Expand());
mainSizer->Add(buttonSizer, 1, wxALIGN_CENTER_HORIZONTAL);
contentPanel->SetSizer(mainSizer);
contentPanel->Center();
contentPanel->Fit();
contentPanel->Layout();
m_topMenu = new wxMenuBar();
SetMenuBar(m_topMenu);
Fit();
Layout();
return contentPanel;
}
What might be the reason of the problem?