I have a DateTimePicker that inherits from UltraMaskedEdit. It has some custom code that catches keystrokes (by overriding ProcessCmdKey) to allow greater flexibility in entering datetimes. For example, being able to type over existing characters without selecting any text.
But when I embed it by setting it as a column's EditorControl or ((Infragistics.Win.IProvidesEmbeddableEditor)myDateTimePicker).Editor as the column's Editor, I lose this behavior. Moving to code to an ((Infragistics.Win.IProvidesEmbeddableEditor)myDateTimePicker).Editor.KeyDown event handler doesn't seem to work either. Is there some way to keep the key processing behavior without resorting to duplicating the key processing code at the grid level?
--yale
My guess is that the keystroke is being handled by the embedable textbox and passed on to the editor not as a key stroke, but in some other way, like setting the Value.
If you want to handle key strokes in the grid, you are really going to need to use the grid's key event, you can't do this through an editor.
If I have a control customControl that inherits from UltraMaskedEdit, then set myColumn.EditorControl = customControl, I observe that:
((IProvidesEmbeddableEditor)customControl).Editor == myColumn.Editor == myCell.EditorResolved ==customControl.ExternalEditor
I attached an event handler to ((IProvidesEmbeddableEditor)customControl).Editor.KeyDown, but that handler never gets called.
When you set the EditorControl property of a grid column or cell, the grid does not actually use the editor control. The editor control merely provides a copy of it's own internal editor for use by the grid. So almost no events of the editor control will fireas a result of an action performed on the grid (the notable exception being the EditorButton events).
The grid gets the editor to use via the IProvidesEmbeddableEditor.Editor method. This interface is implemented by the editor control.
move your code to:
Infragistics.Win.EditorWithMask ed =((Infragistics.Win.IProvidesEmbeddableEditor)this.ultraMaskedEdit1).Editor as Infragistics.Win.EditorWithMask;
ed.KeyDown
Hope that helped
Nassos