NContextMenu Shift+F10 support


Author
Message
Brad Swearingen
Brad Swearingen
Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)
Group: Forum Members
Posts: 53, Visits: 3

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.


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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;
   }
}




Best Regards,
Nevron Support Team


Brad Swearingen
Brad Swearingen
Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)
Group: Forum Members
Posts: 53, Visits: 3
Thanks, that worked well.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search