Nevron Forum

NContextMenu Shift+F10 support

https://www.nevron.com/Forum/Topic5800.aspx

By Brad Swearingen - Friday, November 4, 2011

I don't see a way to connect an NContextMenu to a control.  For instance, the "ContextMenuStrip" property of an NListView won't accept an NContextMenu in the VS Designer.  Is there a way to do this?

I'm assuming I'll have to issue the call to show the context menu during the mouse button up, Shift+F10 KeyDown and ProcessCmdKeys(Keys.App) instead.  This is working fine except for the Shift+F10 support.  I can get the NContextMenu to show during the Shift+F10 KeyDown but this key also causes the NMenuBar on the NForm to get highlighted and it gets the keyboard focus.  Shift+F10 seems to affect an NMenuBar like the Alt key does.  I don't believe it should do that.  Is there a way to stop the NMenuBar to get the keyboard focus when pressing Shift+F10?

To see Shift+F10 work like this just display from the Nevron Examples program any of the Docking Panels examples which have NMenuBars on them.  Put the keyboard focus on a widget which doesn't have a context menu and press Shift+F10 or Alt and both select the NMenuBar.

By Nevron Support - Friday, November 4, 2011

Hi Brad,

Indeed, to display NContextMenu you need to call its Show method on some event.

To avoid Shift+F10 to select a command from NMenuBar you should attach to NCommandBarsManager.PreviewKeyUp and in the event handler to do the following:

private void nCommandBarsManager1_PreviewKeyUp(object sender, KeyEventArgs e)
{
   if (e.Shift && e.KeyCode == Keys.F10)
   {
      e.Handled = true;
   }
}


By Brad Swearingen - Monday, November 7, 2011

Thanks, that worked well.