﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Add shortcutkey to ThemedLinkMenuItem</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sun, 17 May 2026 01:40:51 GMT</lastBuildDate><ttl>20</ttl><item><title>Add shortcutkey to ThemedLinkMenuItem</title><link>http://forum.strataframe.net/FindPost26835.aspx</link><description>A hava a windows with a ThemedLinkMenu and some ThemedLinkMenuItems.&lt;br&gt;
&lt;br&gt;
Is it possible to assign a shortcutkey to a themedlinkmenu item?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Alex B.</description><pubDate>Wed, 14 Apr 2010 10:42:14 GMT</pubDate><dc:creator>Alex Bibiano González</dc:creator></item><item><title>RE: Add shortcutkey to ThemedLinkMenuItem</title><link>http://forum.strataframe.net/FindPost26837.aspx</link><description>That functionality isn't pre-built into the control, but you could certainly handle it manually without much hassle. Just playing around with it myself, the most straight-forward way to do this would seem to be handling the KeyPress event of the form. The only caveat here is that you will need to set the "KeyPreview" property of the form itself to [b]True[/b] so that it will catch the keypresses.&lt;/P&gt;&lt;P&gt;Once the KeyPreview property is true, you can handle either the KeyPress or KeyUp events of the form. KeyPress makes things a bit simpler in that you can just test on the character that resulted from the keypress, while KeyUp will give you more finite control on exactly what buttons were pressed on the keyboard (allowing you test for Alt+Key, Shift+Key, Ctrl+Key combinations and the like).&amp;nbsp;&lt;/P&gt;&lt;P&gt;My test program used the below event handler&amp;nbsp;as the crux of the funcitonality. It's in C#, but is fairly straight forward. Still, if you'd like me to translate to VB, I'd be happy to, just let me know:&lt;/P&gt;&lt;P&gt;[codesnippet]private void Form1_KeyPress(object sender, KeyPressEventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch(e.KeyChar)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case '1':&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; themedLinkMenu1.ClickItem("One");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case '2':&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; themedLinkMenu1.ClickItem("Two");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case '3':&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; themedLinkMenu1.ClickItem("Three");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}[/codesnippet]&lt;/P&gt;&lt;P&gt;You can see there that I am just checking to see if the '1', '2', or '3' keys were pressed and, if so, calling the ThemeLInkMenu's ClickItem method to select the appropriate menu item (which have a Key value of "One", "Two", and "Three" respectively.)</description><pubDate>Wed, 14 Apr 2010 10:42:14 GMT</pubDate><dc:creator>Dustin Taylor</dc:creator></item></channel></rss>