Hi there,
I'd like to have spellchecking in a selected gridcell, where, when right-clicking a ContextMenu should appear with suggestions. In the code below I attach an UltraSpellChecker to an ActiveCell:
private void UltraGrid_AfterCellActivate(object sender, EventArgs e)
{
customEditor.SpellChecker = ultraSpellChecker;
customEditor.ContextMenuStrip = spellingMenuStrip;
ultraGridActiviteitenEnTaken.ActiveCell.EditorControl = customEditor;
}
The spellchecking seems to work, but the MouseDown event does not fire when I (right)click the ActiveCell. Does someone have a solution to this problem?
Ruud
Ruud,
What is happening is that the cell is not in edit mode yet, so the TextBox will not be positioned yet and therefore will not receive the MouseDown message. With this being said, your approach seems to be pretty inefficient; every time that a cell is activated, you are creating a completely new control and assigning it to that editor. Why not create a single instance of the control and then assign it to the column in the InitializeLayout event? Alternatively, you could assign it to individual cells in the InitializeRow event.
-Matt
Hi Matt,
Thanks for your quick reaction! Indeed, my method is somewhat inefficient, but it was only for testing... I did already suspect that the ActiveCell was not in Edit mode, but I don't know how to get it into Edit mode. I tried
UltraGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
but this doesn't work (at least the MouseDown event doesn't fire). Is there a way to put the UltraTextEditor within the ActiveCell into Edit mode so that the event does fire?
Greets,