This is a migrated thread and some comments may be shown as answers.

Shortcuts and Function keys

4 Answers 120 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 03 Aug 2009, 05:01 PM
Hello,

How do I set the function keys with the Shortcuts control ?

I want my search to be invoked by F3

4 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 04 Aug 2009, 08:28 AM
Hello Roland,

Please refer to the following section of our documentation. Since the shortcuts dialog does not allow single key (e.g. F3), you can set some key combination and then go in the Designer.cs file of your form where you can replace the key string with "F3".

Regards,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roland
Top achievements
Rank 1
answered on 04 Aug 2009, 02:15 PM
I tried that before posting here.

Does not work in the 2009.2.9.729. I am setting the command on the button.
0
Accepted
Nick
Telerik team
answered on 05 Aug 2009, 11:04 AM
Hello Roland,

Thank you for your bug report. I checked the commands with RadMenuItems and it seems that they work with them but do not work with RadButton. We will try to provide a fix in future.

What I can suggest currently is to use an IMessageFilter and PerformClick method:

this.radButton1.PerformClick(); 

You need to implement IMessageFilter in the following way:

 public partial class Form5 : Form, IMessageFilter 
    { 
        public Form5() 
        { 
            InitializeComponent(); 
        } 
        #region IMessageFilter Members 
 
        bool IMessageFilter.PreFilterMessage(ref Message m) 
        { 
            if (m.Msg == 0x100 && m.WParam == new IntPtr(0x72)) 
            { 
                this.radButton1.PerformClick(); 
                return true
            } 
 
            return false
        } 
        #endregion 
 
        private void radButton1_Click(object sender, EventArgs e) 
        { 
            MessageBox.Show("Button1 clicked"); 
        } 
    } 

The 0x100 message is WM_KEYDOWN and the 0x72 is the F3 key.

The last bit is to attach the filter:

[STAThread] 
static void Main() 
    Application.EnableVisualStyles(); 
    Application.SetCompatibleTextRenderingDefault(false); 
    Form5 form = new Form5(); 
    Application.AddMessageFilter(form); 
    Application.Run(form); 

I hope that this solution will work for you until we fix the Commands. Thank you very much for your patience.

Best wishes,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roland
Top achievements
Rank 1
answered on 05 Aug 2009, 02:00 PM
Thanks
Tags
General Discussions
Asked by
Roland
Top achievements
Rank 1
Answers by
Nick
Telerik team
Roland
Top achievements
Rank 1
Share this question
or