SetBellOnError() erroneously inversed the value of its parameter. Fixing it to
behave correctly could silently break the existing code which might work
around this bug already because it always behaved like this (ever since it was
added 10.5 years ago). So instead simply deprecate this function and add a new
SuppressBellOnError() one which behaves as expected.
Closes #11318.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62414
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- wxFont::SetNoAntiAliasing() was deprecated, it never really worked in most
ports and was always marked as "experimental" API. It will be replaced with
wxDC-level anti-aliasing control in the future.
+- wxValidator::SetBellOnError() incorrectly interpreted its argument (it
+ disabled the bell when it was true) and was replaced by SuppressBellOnError()
+ with more expected semantics.
Major new features in this release
wxWindow *GetWindow() const { return (wxWindow *)m_validatorWindow; }
void SetWindow(wxWindowBase *win) { m_validatorWindow = win; }
- // validators beep by default if invalid key is pressed, these functions
- // allow to change it
+ // validators beep by default if invalid key is pressed, this function
+ // allows to change this
+ static void SuppressBellOnError(bool suppress = true)
+ { ms_isSilent = suppress; }
+
+ // test if beep is currently disabled
static bool IsSilent() { return ms_isSilent; }
- static void SetBellOnError(bool doIt = true) { ms_isSilent = doIt; }
+
+ // this function is deprecated because it handled its parameter
+ // unnaturally: it disabled the bell when it was true, not false as could
+ // be expected; use SuppressBellOnError() instead
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED_INLINE(
+ static void SetBellOnError(bool doIt = true),
+ ms_isSilent = doIt;
+ )
+#endif
protected:
wxWindowBase *m_validatorWindow;
/**
This functions switches on or turns off the error sound produced by the
validators if an invalid key is pressed.
+
+ @since 2.9.1
+
+ @param suppress
+ If @true, error sound is not played when a validator detects an
+ error. If @false, error sound is enabled.
*/
- static void SetBellOnError(bool doIt = true);
+ static void SuppressBellOnError(bool suppress = true);
/**
Associates a window with the validator.
// All validators share a common (static) flag that controls
// whether they beep on error. Here we turn it off:
- wxValidator::SetBellOnError(m_silent);
+ wxValidator::SuppressBellOnError(m_silent);
file_menu->Check(VALIDATE_TOGGLE_BELL, !wxValidator::IsSilent());
#if wxUSE_STATUSBAR
void MyFrame::OnToggleBell(wxCommandEvent& event)
{
m_silent = !m_silent;
- wxValidator::SetBellOnError(m_silent);
+ wxValidator::SuppressBellOnError(m_silent);
event.Skip();
}