From 76ff441bf2029564ef0d0c1818863d6c10eda81e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 3 Jun 2022 23:00:23 +0100 Subject: [PATCH] Demonstrate disabling radio buttons in the sample Radio buttons are different from the other controls internally in IFileDialogCustomize-based implementation, so check that disabling them also works correctly. --- samples/dialogs/dialogs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 25b8014d3f..437e45e933 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -1731,6 +1731,13 @@ public: // Enable the button if and only if the checkbox is checked. m_btn->Enable(m_cb->GetValue()); + // Enable radio buttons only if a file is selected. + bool hasFile = wxFileName::FileExists( + m_dialog->GetCurrentlySelectedFilename() + ); + m_radioA4->Enable(hasFile); + m_radioLetter->Enable(hasFile); + // Also show the current dialog state. m_label->SetLabelText(GetFileDialogStateDescription(m_dialog)); }