Belgian Keyboard Comma Or Period
Posted : admin On 26.07.2019A dependable application always enjoyed by its user. Thus mac and windowpanes user enjoy many a lot of and forever use this for your increase of activity. Cubase le ai elements 9. Its best-known software for your music business that gives the whole reason for songs production.
We have a .NET 2.0 Windows Forms application with lots of custom controls. A few years ago, we globalized our application, so users see the appropriate culture-specific symbols and translations.
A French Canadian customer has asked us to change how our application handles the number pad decimal key. Our numeric controls are not doing anything when the user presses this key.
I switched my Windows regional settings to French - Canada and debugged our application. I see the current culture and current UI culture are set to fr-CA.
- Mar 03, 2007 You could purchase some keyboard overlay stickers for visual reference. I would have to think that the users wouldn't be using the Numlock very often in comparison to the Comma and Period keys and this would keep these two keys on the Number Pad. You could tweak the layout further by moving around other Number Pad keys to suit your precise needs.
- Loading the keyboard layout, please wait.
In OnKeyDown and OnKeyPress I see the difference between the keyboard period (Keys.OemPeriod) and number pad period (Keys.Decimal). The specific keystroke comes across in OnKeyDown. However, in both cases, the OnKeyPress event gives our control a period:
The numbers block should enter a comma when typing the '.' But the keyboard layout on windows is set to Belgian (period).
Our numeric controls handle number input in the OnKeyPress event. Since the period is not a decimal separator in the current culture, the control reject this character.
Is the globalization setting supposed to translate Keys.Decimal (number pad '.') into a comma automatically, or is our application supposed to change Keys.Decimal into the culture-specific decimal separator? I expected .NET to make this translation automatically.
Paul WilliamsPaul Williams1 Answer
The OnKeyDown event is generated by the Windows WM_KEYDOWN event. WM_KEYDOWN is sending our application a Key.Decimal event.
Similarly, the OnKeyPress event is generated directly from the WM_CHAR event. In the case of French - Canadian regional settings (with Canadian French keyboard), Windows sends a WM_CHAR event with a period when the user presses the number pad decimal key. However, in the case of French - Belgian settings with the 'Belgian (Comma)' input settings, Windows sends a WM_CHAR event with a comma.
So this is neither a .NET bug nor a bug in our application. The regional input settings affects the behavior of the Decimal key.
However, some applications do respond differently in French - Canadian settings. For example, both Excel and Windows Calculator both translate Keys.Decimal into a comma instead of a period. These applications may have special handling for this case.
We could add code to our application to track a decimal key and handle it differently. For example:
Paul Williams