Home All Groups Group Topic Archive Search About

F1 keydown for menuitem

Author
9 Apr 2007 7:19 PM
B.
Each of my menuitem has a help topic. When user selects the menuitem
and press F1, it should pop up the help. However, how can I catch the
F1 keydown event for the menuitem? There is no keydown event for the
menuitem.

Author
10 Apr 2007 11:38 AM
ClayB
One way you can do this is to override the form's WndProc and look for
WM_HELP.

        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x53) //WM_HELP
            {
                if (this.filesToolStripMenuItem.Selected)
                {
                    MessageBox.Show(string.Format("F1 pressed {0}",
this.filesToolStripMenuItem.Name));
                }
                else if (this.filesOpenToolStripMenuItem.Selected)
                {
                    MessageBox.Show(string.Format("F1 pressed {0}",
this.filesOpenToolStripMenuItem.Name));
                }
            }
            base.WndProc(ref m);
        }

================
Clay Burch
Syncfusion, Inc.
Author
17 Apr 2007 4:57 PM
B.
Is this solution for MenuStrip? My form is still using menu.

Show quote
On Apr 10, 4:38 am, "ClayB" <c***@syncfusion.com> wrote:
> One way you can do this is to override the form's WndProc and look for
> WM_HELP.
>
>         protected override void WndProc(ref Message m)
>         {
>             if (m.Msg == 0x53) //WM_HELP
>             {
>                 if (this.filesToolStripMenuItem.Selected)
>                 {
>                     MessageBox.Show(string.Format("F1 pressed {0}",
> this.filesToolStripMenuItem.Name));
>                 }
>                 else if (this.filesOpenToolStripMenuItem.Selected)
>                 {
>                     MessageBox.Show(string.Format("F1 pressed {0}",
> this.filesOpenToolStripMenuItem.Name));
>                 }
>             }
>             base.WndProc(ref m);
>         }
>
> ================
> Clay Burch
> Syncfusion, Inc.

AddThis Social Bookmark Button