Using 2007 V1, I have tried couple of suggestions that were documents that I found. none seem to work consistently or correctly. Mouse_Up event of the UltraTextbox hardly ever seems to fire on an actual mouse up...go figure. Also it suggests checking length but when I select and right click with the mouse it never fires. The only time I could ever get it to fire is right clicking on the far left 3-4 pixel space between the text and the left side of the text box (more often than not I got the default MS? context menu with Copy/Paste/Undo, etc). I have tried the suggestion that said to use SetContextMenuUltra - however this doesnot work as you need a key and the minitoolbar (at least by default) does not have a key. I tried setting the key which is a hidden property and that failed as well. (http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/WinToolbarsManager_Show_the_MiniToolbar_with_a_Context_Menu.html)
All I want to do is select text in a text box (multiline) and right click to get a minitoolbar just like in Word 2007.
You would not think that this should be all that hard. What am I missing?
You cannot get the mouse events for the UltraTextEditor becuase it shows a .NET TextBox over itself for editing. This TextBox is actually getting clicked by the mouse. If the UltraTextEditor has AlwaysInEditMode set to True, you can hook the TextBox's MouseDown event like this:
((Infragistics.Win.EditorWithText)this.ultraTextEditor1.Editor).TextBox.MouseDown += new MouseEventHandler( this.ultraTextEditor1_MouseDown );
However, if AlwaysInEditMode is set to False, you will need to hook this event in the AfterEnterEditMode event of the text editor and unhook the event in the AfterExitEditMode event.
As far as SetContextMenuUltra, that will not work with the MiniToolbar, because it is not a PopupMenuTool. If you do set a PopupMenuTool as the context menu for the TextBox, the MiniToolbar will show with the PopupMenuTool, just as it does in Word. But if you just want to show the MiniToolbar by itself, you can call one of the Show() methods on it.