Roberto Wenzel
Top achievements
Rank 2
Roberto Wenzel
asked on 15 Dec 2010, 02:53 PM
Hello,
I would like to access the Tabs in my Pageview control with the keyboard.
I am used to type e.g. "&Tabpage" with the ampersand for the PageViewPage text attribute, so that the T is underlined and I can use the ALT + T keys to activate that Pageviewpage.
Unfortunately this does not work. I always have "&Tabpage" as visible text.
Which settings do I have to make to activate the UseMnemonic feature. I tried several but with no success.
Could someone please help me.
Thanks in advance.
Cheers Roberto
I would like to access the Tabs in my Pageview control with the keyboard.
I am used to type e.g. "&Tabpage" with the ampersand for the PageViewPage text attribute, so that the T is underlined and I can use the ALT + T keys to activate that Pageviewpage.
Unfortunately this does not work. I always have "&Tabpage" as visible text.
Which settings do I have to make to activate the UseMnemonic feature. I tried several but with no success.
Could someone please help me.
Thanks in advance.
Cheers Roberto
5 Answers, 1 is accepted
0
Richard Slade
Top achievements
Rank 2
answered on 15 Dec 2010, 04:17 PM
Hello,
I've tried this in the latest version, but also could not get mnemonics to work as expected. The code I tried is as follows:
However, as of Q2 2010 Telerik have introduced a new shortcut mechanism (RadShortcut) which introduces many improvements. It also supports the so called "Global Shortcuts" which might help in your case. More information can be found at this link.
Hope that helps
Richard
I've tried this in the latest version, but also could not get mnemonics to work as expected. The code I tried is as follows:
Me
.RadPageView1.ViewMode = PageViewMode.Strip
Me
.RadPageView1.ViewElement.UseMnemonic =
True
Me
.RadPageViewPage1.Item.UseMnemonic =
True
Me
.RadPageViewPage2.Item.UseMnemonic =
True
Me
.RadPageViewPage3.Item.UseMnemonic =
True
Me
.RadPageViewPage1.Text =
"&First"
Me
.RadPageViewPage2.Text =
"&Second"
Me
.RadPageViewPage3.Text =
"&Third"
However, as of Q2 2010 Telerik have introduced a new shortcut mechanism (RadShortcut) which introduces many improvements. It also supports the so called "Global Shortcuts" which might help in your case. More information can be found at this link.
Hope that helps
Richard
0
Roberto Wenzel
Top achievements
Rank 2
answered on 16 Dec 2010, 02:29 PM
Thank you Richard for your hint.
Unfortunately I could not get this to work, but I have a workaround for this issue:
Example for Visual Basic
1. Use the following structure for your RadPageViewPage.Text value
<html><u>U</u>ser</html>
where the "U" of the word "User" is underlined.
2. Set the KeyPreview feature of your form to "true" to validate keyboard strokes.
3. Add the following code to the KeyDown event of your form
E.g. to capture the "ALT+U" key event and select a PageViewPage called "User":
If e.Alt And e.KeyCode.ToString = "U" Then
e.SuppressKeyPress = True
Dim pv_user As RadPageViewPage = Me.rpvp_User
Me.rpvw_Settings.SelectedPage = pv_user
End If
The code line " e.SuppressKeyPress = True " suppresses the Beeping
Hope that might help somebody.
Cheers Roberto
Unfortunately I could not get this to work, but I have a workaround for this issue:
Example for Visual Basic
1. Use the following structure for your RadPageViewPage.Text value
<html><u>U</u>ser</html>
where the "U" of the word "User" is underlined.
2. Set the KeyPreview feature of your form to "true" to validate keyboard strokes.
3. Add the following code to the KeyDown event of your form
E.g. to capture the "ALT+U" key event and select a PageViewPage called "User":
If e.Alt And e.KeyCode.ToString = "U" Then
e.SuppressKeyPress = True
Dim pv_user As RadPageViewPage = Me.rpvp_User
Me.rpvw_Settings.SelectedPage = pv_user
End If
The code line " e.SuppressKeyPress = True " suppresses the Beeping
Hope that might help somebody.
Cheers Roberto
0
Richard Slade
Top achievements
Rank 2
answered on 16 Dec 2010, 02:31 PM
Hi Roberto,
I'm glad that you found a workaround. Perhaps this will be on the ToDo list for a future release or service pack.
All the best
Richard
I'm glad that you found a workaround. Perhaps this will be on the ToDo list for a future release or service pack.
All the best
Richard
0
Accepted
Hello Roberto,
There is an easier way of achieving this. First of all, it is enough to set the UseMnemonics and ShowKeyboardCues properties to True and then you can set the underlined letter by an ampersand before it:
This will make the 'e' letter underlined, but the item will not react to any keyboard input. You can fix this by using our shortcuts mechanism. Please refer to the following code:
We add a shortcut to the item and subscribe to its click event because when the shortcut is executed, the click event of the item is fired (but the pages are selected on the MouseDown event which is not fired). So we handle the click event of the item and select its corresponding page. Please refer to the following snippet:
Another approach is to implement your own custom shortcut provider. You can find more information about shortcuts on the link that Richard posted.
I hope this was helpful. Should you have any further questions, do not hesitate to ask.
Greetings,
There is an easier way of achieving this. First of all, it is enough to set the UseMnemonics and ShowKeyboardCues properties to True and then you can set the underlined letter by an ampersand before it:
RadPageViewPage1.Item.Text =
"N&ew"
RadPageViewPage1.Item.UseMnemonic =
True
RadPageViewPage1.Item.ShowKeyboardCues =
True
This will make the 'e' letter underlined, but the item will not react to any keyboard input. You can fix this by using our shortcuts mechanism. Please refer to the following code:
RadPageViewPage1.Item.Shortcuts.Add(
New
RadShortcut(Keys.Alt, Keys.E))
AddHandler
RadPageViewPage1.Item.Click,
AddressOf
Item_Click
We add a shortcut to the item and subscribe to its click event because when the shortcut is executed, the click event of the item is fired (but the pages are selected on the MouseDown event which is not fired). So we handle the click event of the item and select its corresponding page. Please refer to the following snippet:
Private
Sub
Item_Click(sender
As
Object
, e
As
EventArgs)
RadPageView1.SelectedPage = TryCast(sender, RadPageViewItem).Page
End
Sub
Another approach is to implement your own custom shortcut provider. You can find more information about shortcuts on the link that Richard posted.
I hope this was helpful. Should you have any further questions, do not hesitate to ask.
Greetings,
Ivan Todorov
the Telerik team
Check out the Q1 2011 Roadmap for Telerik Controls for Windows Forms.
0
Roberto Wenzel
Top achievements
Rank 2
answered on 21 Dec 2010, 06:25 PM
Hello Ivan,
thank you very much for your solution. Its perfect and hels a lot.
Cheers Roberto
thank you very much for your solution. Its perfect and hels a lot.
Cheers Roberto