Shortcuts and Function keys

5 posts, 1 answers
  1. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 03 Aug 2009 Link to this post

    Hello,

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

    I want my search to be invoked by F3

  2. Nick
    Admin
    Nick avatar
    767 posts

    Posted 04 Aug 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 04 Aug 2009 Link to this post

    I tried that before posting here.

    Does not work in the 2009.2.9.729. I am setting the command on the button.
  5. Answer
    Nick
    Admin
    Nick avatar
    767 posts

    Posted 05 Aug 2009 Link to this post

    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.
  6. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 05 Aug 2009 Link to this post

    Thanks
Back to Top
UI for WinForms is Visual Studio 2017 Ready