Add support for wxHELP button to wxMessageDialog.
Implement support for wxHELP for wxMSW, wxGTK and wxOSX/Cocoa (at least when showing the message box from the main thread, there doesn't seem to be any way to show more than three buttons with CFUserNotificationDisplayAlert() so "Help" button is not supported when using it). This is useful not only on its own, i.e. to allow the user to ask for help, but also because it brings the total number of buttons supported by the message dialog to 4, meaning that more choices can be offered to the user (which is rarely, but not quite never, useful). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2669,6 +2669,7 @@ const TestMessageBoxDialog::BtnInfo TestMessageBoxDialog::ms_btnInfo[] =
|
||||
{ wxNO, "&No" },
|
||||
{ wxOK, "&Ok" },
|
||||
{ wxCANCEL, "&Cancel" },
|
||||
{ wxHELP, "&Help" },
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(TestMessageBoxDialog, wxDialog)
|
||||
@@ -2889,6 +2890,11 @@ void TestMessageBoxDialog::PrepareMessageDialog(wxMessageDialogBase &dlg)
|
||||
dlg.SetOKLabel(m_labels[Btn_Ok]->GetValue());
|
||||
}
|
||||
}
|
||||
|
||||
if ( style & wxHELP )
|
||||
{
|
||||
dlg.SetHelpLabel(m_labels[Btn_Help]->GetValue());
|
||||
}
|
||||
}
|
||||
|
||||
void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
||||
@@ -2896,7 +2902,34 @@ void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
||||
wxMessageDialog dlg(this, GetMessage(), "Test Message Box", GetStyle());
|
||||
PrepareMessageDialog(dlg);
|
||||
|
||||
dlg.ShowModal();
|
||||
wxString btnName;
|
||||
switch ( dlg.ShowModal() )
|
||||
{
|
||||
case wxID_OK:
|
||||
btnName = "OK";
|
||||
break;
|
||||
|
||||
case wxID_CANCEL:
|
||||
// Avoid the extra message box if the dialog was cancelled.
|
||||
return;
|
||||
|
||||
case wxID_YES:
|
||||
btnName = "Yes";
|
||||
break;
|
||||
|
||||
case wxID_NO:
|
||||
btnName = "No";
|
||||
break;
|
||||
|
||||
case wxID_HELP:
|
||||
btnName = "Help";
|
||||
break;
|
||||
|
||||
default:
|
||||
btnName = "Unknown";
|
||||
}
|
||||
|
||||
wxLogMessage("Dialog was closed with the \"%s\" button.", btnName);
|
||||
}
|
||||
|
||||
void TestMessageBoxDialog::OnClose(wxCommandEvent& WXUNUSED(event))
|
||||
|
Reference in New Issue
Block a user