virtualKeyboard doesn't apply language completely

2 Answers 382 Views
VirtualKeyboard
Jana
Top achievements
Rank 2
Iron
Iron
Iron
Jana asked on 05 Jul 2021, 10:17 AM

Hello, 

I'm facing a little problem concerning the radVirtualKeyboard control. I'm located in France and I would like the virtual keyboard to have the AZERTY-laoyout. No matter If I use the property SynchronizeCultureWithSystem or if I set the culture info manually, the keyboard only adapts some of the keys but the general layout remains QWERTY. 

I'm using the code 

radVirtualKeyboard1.SynchronizeCultureWithSystem = false;
radVirtualKeyboard1.VirtualKeyboardElement.CurrentCulture = new System.Globalization.CultureInfo("fr-FR", false);

This is the result: 

The code
radVirtualKeyboard1.SynchronizeCultureWithSystem = false;
radVirtualKeyboard1.VirtualKeyboardElement.CurrentCulture = new System.Globalization.CultureInfo("de-DE", false);

leads to this result which is not correct as well because the german keyboard layout is QWERTZ

Is there maybe another property to set to apply the culture info to the entire keyboard?

Thank you in advance and have a nice day!

Jana

2 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 07 Jul 2021, 10:43 AM

Hello, Jana,

As you noted RadVirtualKeyboard has a default QWERTY keyboard layout.

Currently, the keyboard layout is not updated for specific cultures, but this seems to be a reasonable request. That is why I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

In order to achieve an AZERTY layout, you can swap the Q with A keys and W with Z keys from the keyboard. Here is a code sample that illustrates this approach:

SimplifiedVirtualKeyboardLayoutPanel simplifiedLayoutPanel = this.radVirtualKeyboard1.MainLayoutPanel as SimplifiedVirtualKeyboardLayoutPanel;
VirtualKeyboardLayout mainLayout = simplifiedLayoutPanel.MainButtonsLayout;

// Find the W, Q, A and Z keys and their indices in their corresponding row.  
Key Qkey = mainLayout.Rows[1].Keys.FirstOrDefault(k => k.VirtualKey == (int)Keys.Q) as Key;
int qKeyIndex = mainLayout.Rows[1].Keys.IndexOf(Qkey);

Key Wkey = mainLayout.Rows[1].Keys.FirstOrDefault(k => k.VirtualKey == (int)Keys.W) as Key;
int wKeyIndex = mainLayout.Rows[1].Keys.IndexOf(Wkey);

Key Akey = mainLayout.Rows[2].Keys.FirstOrDefault(k => k.VirtualKey == (int)Keys.A) as Key;
int aKeyIndex = mainLayout.Rows[2].Keys.IndexOf(Akey);

Key Zkey = mainLayout.Rows[3].Keys.FirstOrDefault(k => k.VirtualKey == (int)Keys.Z) as Key;
int zKeyIndex = mainLayout.Rows[3].Keys.IndexOf(Zkey);

// Remove the keys from their old position
mainLayout.Rows[1].Keys.Remove(Qkey);
mainLayout.Rows[1].Keys.Remove(Wkey);
mainLayout.Rows[2].Keys.Remove(Akey);
mainLayout.Rows[3].Keys.Remove(Zkey);

// Add the keys on their new positions Q-A and W-Z 
mainLayout.Rows[1].Keys.Insert(qKeyIndex, Akey);
mainLayout.Rows[1].Keys.Insert(wKeyIndex, Zkey);
mainLayout.Rows[2].Keys.Insert(aKeyIndex, Qkey);
mainLayout.Rows[3].Keys.Insert(zKeyIndex, Wkey);

// Force the layout to update
mainLayout.ResetLayout(true);
This is an illustration of how to modify an existing predefined keyboard layout.
The suggested way to use this modified layout is to store it in an XML file and load it when your application starts. I have saved and attached a ZIP with XML files with the AZERTY and QWERTZ layouts. You can simply load them using the LoadLayout method of RadVirtualKeyboard.
this.radVirtualKeyboard1.LoadLayout(@"..\..\Layouts\azerty.xml");
//this.radVirtualKeyboard1.LoadLayout(@"..\..\Layouts\qwertz.xml");
Here is a sample snapshot of the keyboard:


I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Todor Vyagov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Jana
Top achievements
Rank 2
Iron
Iron
Iron
commented on 07 Jul 2021, 03:26 PM

Hello Todor,

Thank you very much for your reply and for the layout examples, that helps me a lot to progress.

 

Have a nice day,

Jana

0
Jana
Top achievements
Rank 2
Iron
Iron
Iron
answered on 28 Sep 2021, 03:16 PM

Hello again,

I know it's been a while since the last communication here in this thread but I have indeed just a little more question about this subject. I would like to create an own layout in an XML file like the one you've attached me. As I can see, the keys are identified by keyType and by virtualKey= with a number behind. Is there somewhere a kind of overview existing, which shows which key has which number?

Thank you again and have a nice day!

Nadya | Tech Support Engineer
Telerik team
commented on 29 Sep 2021, 09:52 AM

Hello, Jana,

If you want to create your own layout in an XML file like the one Todor has attached you can use the Save/Load layout functionality that RadVirtualKeyboard offers. Please refer to the following article: https://docs.telerik.com/devtools/winforms/controls/virtual-keyboard/save-and-load-layout 

Feel free to customize the keyboard and create the desired layout as demonstrated here according to your specific needs, then save the layout by calling the SaveLayout method. Those layout settings would be written in an XML file and the necessary information about keys would be automatically stored.

I hope this information helps. Do not hesitate to contact us if you have other questions.

Regards,
Nadya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Jana
Top achievements
Rank 2
Iron
Iron
Iron
commented on 29 Sep 2021, 03:48 PM

Hello Dess,

Thank you very much for your further explanation, I understand.

I tried to create a custom layout of a numeric keyboard and a simplified azerty keyboard. The example of Todor was unfortunately not 100% complete AZERTY so I had to change also the positions of buttons with accents and special characters. But that is not serious :)

So I tried to modify the keyboard layout and on runtime it's all fine. But if I try to load my custom layout in another project, the keyboardForm doesn't apply the layout at all. Am I missing something?

I attached you the demo project in which I modify the layout as well as a second demo project in which I try to load the custom layout. Thank you in advance for your help!

https://easyupload.io/m/ng6mwt

What I would like to achieve:

Jana
Top achievements
Rank 2
Iron
Iron
Iron
commented on 30 Sep 2021, 10:16 AM

Hello again, 

I'm sorry to flood you with a lot of questions :)

I noticed another problem with the keyboards. In the meantime until there is an answer to my previous post, I wanted to already integrate the keyboards with my desired layout into my main application I'm currently working on. So I didn't load the layout from an xml file, but I copied the code snipped to arrange the buttons from my test project that I've attached to my previous post. 

My main application is meant to run on a Windows 10 tablet (Dell Latitude 7212).
I'm facing the following problem: If I run this app on my PC, the numeric keyboard is displayed correctly. But for the AZERTY-Keyboard, I receive this result: 

Some keys were placed well, some others not. 

When I run my app on the tablet, I receive this same result for the AZERTY keyboard. But also the numeric keyboard is not correct at all:

I'm a bit surprised as the keyboard layout changes between the Windows 10 laptop and the Windows 10 tablet even if the code was not changed. Do you have any idea which properties or information I can check out in order to resolve this? 

 

Thank you very much in advance!

Todor
Telerik team
commented on 04 Oct 2021, 01:56 PM

Hi Jana,

Thanks for the sent project. It helped me a lot to investigate the precise scenario.

1) Save layout
I have reviewed the saved layout and I confirm that you hit a serialization issue that is fixed in our latest version R3 2021 - "RadVirtualKeyboard: Modified and saved layout cannot be loaded".
If you cannot upgrade or do not plan to upgrade to our latest version, you can manually modify the second line of the serialized file with XML:
From:

  <MainLayoutPanel xsi:type="Telerik.WinControls.VirtualKeyboard.SimplifiedVirtualKeyboardLayoutPanel" 
To:
<MainLayoutPanel xsi:type="Telerik.WinControls.VirtualKeyboard.VirtualKeyboardLayoutPanel" 


2) Numeric keyboard
RadVirtualKeyboard tracks the state of several keys - for example, Crtl, Caps Lock, Num Lock. The keys in the NumLock layout are special keys that display different symbols, depending on the NumLock key of the Windows. If the NumLock is activated - the numbers are visible, else the arrows and page up/down buttons are displayed.
In your case, it seems that the NumLock is not active.
In order to use numeric key values, you can toggle the NumLock key if it is off and unsubscribe the numeric keyboard from all key events, and if the NumLock key is pressed the numeric keys will not convert to arrows.

if (!RadVirtualKeyboardElement.IsNumLockOn)
{
    VirtualKeyboardNativeMethods.Send(null, (int)Keys.NumLock);
}

RadVirtualKeyboardElement.UpdateKeysListenersList.Remove(radVirtualKeyboardFormNumeric.KeyboardForm.VirtualKeyboard.VirtualKeyboardElement);

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Todor Vyagov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
VirtualKeyboard
Asked by
Jana
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Todor
Telerik team
Jana
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or