Window 10: wxBell when wxTextCtrl max length is exceeded Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Vilrik
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Apr 03, 2020 1:33 pm

Window 10: wxBell when wxTextCtrl max length is exceeded

Post by Vilrik » Fri Apr 03, 2020 1:55 pm

Good afternoon!

I set a maximum length a bunch of wxTextCtrl. Now whenever the input exceeds the set limit the bell rings. I tried wxValidator::SuppressBellOnError(), but it still plays. I tried to catch the event and then skip it, but it keeps playing. Any suggestions on how to stop the bell?

OS: Windows 10
Compiler: Default Visual Studio 2019 community
wxWidgets: 3.13

User avatar
doublemax
Moderator
Moderator
Posts: 14786
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Window 10: wxBell when wxTextCtrl max length is exceeded

Post by doublemax » Fri Apr 03, 2020 3:33 pm

I'm almost certain that it's Windows itself that plays the beep, not wxWidgets.

I only found thit post about suppressing the beep under Windows, but it seems like an unreasonable amount of effort:
https://stackoverflow.com/a/55885061

I also think that the beep is justified when the user enters text and it reaches the text limit.
Use the source, Luke!

Vilrik
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Apr 03, 2020 1:33 pm

Re: Window 10: wxBell when wxTextCtrl max length is exceeded

Post by Vilrik » Fri Apr 03, 2020 5:02 pm

doublemax wrote:
Fri Apr 03, 2020 3:33 pm
I'm almost certain that it's Windows itself that plays the beep, not wxWidgets.

I only found thit post about suppressing the beep under Windows, but it seems like an unreasonable amount of effort:
https://stackoverflow.com/a/55885061

I also think that the beep is justified when the user enters text and it reaches the text limit.
Well, in my case I am making a 9 by 9 grid of wxTextCtrls to enter numbers. I wanted to learn GUI programming, so right now I am making a graphical interface for my sudoku solver. I fixed this issue by handling the length and value of the string manually whenever a cell (wxTextCtrl) is changed using wxEVT_TEXT.

Still the beeping annoys me slightly. I also have beeping when I press enter or tab in a wxTextCtrl, but I will try to solve this by handling keyboard input.

Last question: is it possible to suppress the beeping of a wxWidgets program altogether? Or will there always be some cases that a program will beep, because wxWidgets is using Windows directly (if I understand correctly) and Windows will beep?

User avatar
doublemax
Moderator
Moderator
Posts: 14786
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Window 10: wxBell when wxTextCtrl max length is exceeded

Post by doublemax » Fri Apr 03, 2020 5:41 pm

Last question: is it possible to suppress the beeping of a wxWidgets program altogether? Or will there always be some cases that a program will beep, because wxWidgets is using Windows directly (if I understand correctly) and Windows will beep?
The majority of controls in wxWidgets are wrappers around the native control on the respective platform. The beeping can not be globally disabled.
Use the source, Luke!

Post Reply