Select active mode in display sample

Update sample to use SizerFlags.
Set a minimum size to the dialog.
This commit is contained in:
Maarten Bent
2019-11-21 23:18:30 +01:00
parent 44cd0409cd
commit c4e54c78fd

View File

@@ -299,7 +299,7 @@ void MyFrame::PopuplateWithDisplayInfo()
// add it to another sizer to have borders around it and button below
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(sizer, 1, wxALL | wxEXPAND, 10);
sizerTop->Add(sizer, wxSizerFlags(1).Expand().DoubleBorder());
#if wxUSE_DISPLAY
wxChoice *choiceModes = new wxChoice(page, Display_ChangeMode);
@@ -312,16 +312,18 @@ void MyFrame::PopuplateWithDisplayInfo()
choiceModes->Append(VideoModeToText(mode),
new MyVideoModeClientData(mode));
}
const wxString currentMode = VideoModeToText(display.GetCurrentMode());
choiceModes->SetStringSelection(currentMode);
sizer->Add(new wxStaticText(page, wxID_ANY, "&Modes: "));
sizer->Add(choiceModes, 0, wxEXPAND);
sizer->Add(new wxStaticText(page, wxID_ANY, "&Modes: "),
wxSizerFlags().CentreVertical());
sizer->Add(choiceModes, wxSizerFlags().Expand());
sizer->Add(new wxStaticText(page, wxID_ANY, "Current: "));
sizer->Add(new wxStaticText(page, Display_CurrentMode,
VideoModeToText(display.GetCurrentMode())));
sizer->Add(new wxStaticText(page, Display_CurrentMode, currentMode));
sizerTop->Add(new wxButton(page, Display_ResetMode, "&Reset mode"),
0, wxALL | wxCENTRE, 5);
wxSizerFlags().Centre().Border());
#endif // wxUSE_DISPLAY
page->SetSizer(sizerTop);
@@ -331,6 +333,7 @@ void MyFrame::PopuplateWithDisplayInfo()
}
SetClientSize(m_book->GetBestSize());
SetMinSize(GetSize());
}
#if wxUSE_DISPLAY