Approved
Last Updated: 30 Mar 2016 09:14 by ADMIN
ADMIN
George
Created on: 27 Jan 2014 11:28
Category:
Type: Bug Report
0
FIX. RadMenu - when RadMenu is added to a MDI child Form only the main RadMenu is accessible through shortcuts with Alt Key
To reproduce:

Add a RadForm as MDI child to another form. Add RadMenu to the child and the main forms. Associate hotkeys as follows:

RadMenuItem item = new RadMenuItem;
item.Text = "&File";

You will notice that only the main menu can be accessed with the Alt key and the shortcut.

Workaround:
Subscribe for each childform's KeyUp event and use the following event handler:
private void childForm_KeyUp(object sender, KeyEventArgs e)
{
    Form form = sender as Form;
    if (!form.Focused)
    {
        return;
    }

    RadMenu menu = null;
    foreach (Control control in form.Controls)
    {
        if (control is RadMenu)
        {
            menu = control as RadMenu;
            break;
        }
    }

    if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt && menu != null)
    {
        foreach (RadItem item in menu.Items)
        {
            int ampersantIndex = item.Text.IndexOf("&");
            if (ampersantIndex != -1)
            {
                char hotkeyChar = item.Text[ampersantIndex + 1];
                if (char.ToLower(hotkeyChar) == char.ToLower((char)e.KeyValue))
                {
                    item.PerformClick();
                    break;
                }
            }
        }
    }
}

0 comments