Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
How to fire the MouseDown event in an ActiveCell of the UltraGrid control?
posted

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)

{

UltraTextEditor customEditor = new UltraTextEditor();

customEditor.SpellChecker = ultraSpellChecker;

customEditor.ContextMenuStrip = spellingMenuStrip;

((Infragistics.Win.
EditorWithText)customEditor.Editor).TextBox.MouseDown += new MouseEventHandler(CustomEditor_MouseDown);

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

Parents
No Data
Reply
  • 37774
    posted

    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 

Children