From 5cc2f6ce9fd206c5e46e73188291e053b0013bb4 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Sat, 13 Feb 2021 00:04:45 +0100 Subject: [PATCH] Fix width of file type wxChoice in open dialogs on macOS When using both an extra control and wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES set to 1 to show file types, the controls for the latter stretch towards the dialog's width. Fix by not stretching the wxChoice used for filtering and surrounding the file type controls with stretching spacers instead. This makes the filter controls appear the same as without an extra control: horizontally centred and not stretching. --- src/osx/cocoa/filedlg.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 99536113ee..dabb77f4a8 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -261,10 +261,12 @@ wxWindow* wxFileDialog::CreateFilterPanel(wxWindow *extracontrol) { wxBoxSizer *horizontalSizer = new wxBoxSizer(wxHORIZONTAL); verticalSizer->Add(horizontalSizer, 0, wxEXPAND, 0); + horizontalSizer->AddStretchSpacer(); wxStaticText *stattext = new wxStaticText( extrapanel, wxID_ANY, _("File type:") ); horizontalSizer->Add(stattext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_filterChoice = new wxChoice(extrapanel, wxID_ANY); - horizontalSizer->Add(m_filterChoice, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + horizontalSizer->Add(m_filterChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + horizontalSizer->AddStretchSpacer(); m_filterChoice->Append(m_filterNames); if( m_filterNames.GetCount() > 0) {