Profile Picture

NContextMenu problem with NRichTextBox

Posted By Brian J Warren 13 Years Ago
Author
Message
Brian J Warren
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 26, Visits: 28

Hello Nevron,

I have a small problem using an NContextMenu with an NRichTextBox.  The attachment named CorrectMenu.jpg shows the correct NContextMenu displayed when clicking the NRichTextBox underneath.  This is implemented by displaying the NContextMenu on the MouseDown event of the NRichTextBox (checked for a right-click).  This only works properly when the NRichTextBox does not have focus.

The problem happens when the NRichTextBox does have focus (and displays the flashing cursor).  When the user does a right-click, the proper menu comes up, but then immeadiatly after the NRichTextBox default menu comes up and covers it (see attachment named DefaultMenu.jpg). 

Can you tell me the correct way to make this work?

Thank you, Brian Warren



Attachments
CorrectMenu.jpg (228 views, 14.00 KB)
DefaultMenu.jpg (231 views, 13.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: 2 hours ago
Posts: 3,043, Visits: 3,777
Hello Brian,

This is happening because NRichTextBox has build in Context menu, and when the control is focused and you right click on it it shows both.
Currently, you can disable this context menu by overriding WndProc as follows:

public class MyNRichTextBox : NRichTextBox
{
   protected override void WndProc(ref Message m)
   {
      if (m.Msg != Nevron.Interop.Win32.NWMConstants.WM_RBUTTONUP)
      {
         base.WndProc(ref m);
      }         
   }
}

In the next release we will add a new property which turns it on and off.

Best Regards,
Nevron Support Team



Brian J Warren
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 26, Visits: 28

Thank you to the Support Team,

That worked fine.  Thank you for the help.

Best regards, Brian Warren





Similar Topics


Reading This Topic