I am embeding an UltraMaskedEdit within grid cell.
I am doing that in the following way:
1) grid_.DisplayLayout.Bands[0].Columns["Start"].UseEditorMaskSettings = true;
Note, that column's DataType is String.
2) On InitializeRow event I am adding editior to the grid cell:
UltraMaskedEdit ultraMaskedEdit = new UltraMaskedEdit(); ultraMaskedEdit.EditAs = EditAsType.Time; e.Row.Cells["Start"].EditorControl = ultraMaskedEdit;
To be exact, when I double click on this cell it does not select text and does not have behaviour of cell which is in edit mode, but i am able to edit text correctly according to Time mask.
How can I get behaviour of edit mode for cell if it has ultraMaskedEdit?
Thanks in advance.
I don't understand the question. What exactly is the behavior you are getting?
a)When I double click on a cell without embedding editor this cell enters in edit mode :
1. This cell selects the text it contains
2. Carriage is set after last symbol and it blinks.
This is a nornal Edit Mode's behavior. See image below:
b) The behavior I am getting for cell with editor is following :
When I double click on a cell it does not selects text and carriage is not set after last symbol. This is very inconvenient for an user.
See image below:
But after double clicking on this cell and typing text I am still able to edit this cell's text according to Time mask I setuped.
Mike, do you have a chance to answer my last reply?
Are you double-clicking the cell before or after itgoes into edit mode?
I think the mask editor might edit by sections, so double-clicking would only select the section. But your screen shot does not even appear to have the cell in edit mode.
Also, what version of the controls are you using? Do you have the latest hot fix?
Can you duplicate this behavior in a small sample project? If so, you can Submit an incident to Infragistics Developer Support and they can check it out. Or post is here first, and I will try to take a look.
We have found the reason of this incorrect behavior for cell with MaskedEditor.
This is CellClickAction property setuped in CellClickAction.CellSelect.
But for cell without Editor CellClickAction.CellSelect works correctly.
Alex.
I've had the same problem trying to get a Drop Down List cell and a Date/Time cell to go into edit mode on a double-click with the cell click action set to Cell Select.
Since it appeared to be going into edit mode and immediatelty coming out of edit mode I used the BeforeExitEditMode event to cancel the exit if I have just double-clicked on a cell.
You end up with the following code (not fully tested yet):
Private mDoubleClick As Boolean = False
Private Sub SmpGrid_DoubleClickCell(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs) Handles SmpGrid.DoubleClickCell If SmpGrid.ActiveCell IsNot Nothing AndAlso SmpGrid.ActiveCell.CanEnterEditMode Then mDoubleClick = True SmpGrid.PerformAction(UltraWinGrid.UltraGridAction.EnterEditMode, False, False) End If End Sub
Private Sub SmpGrid_BeforeExitEditMode(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeExitEditModeEventArgs) Handles SmpGrid.BeforeExitEditMode If mDoubleClick Then mDoubleClick = False e.Cancel = True End If End Sub
It's a bit tacky but it works.
John.
Hi, mikeahoyle.
Yes. I have found the workaround.
See attached small project for more details.
The main idea of workaround is set CellClickAction to CellClickAction.RowSelect
for DisplayLayout.Override.CellClickAction of ultra grid and for columns that contain MaskedEditor at first initialization.
Then in OnDoubleClickRow event it's needed to change CellClickAction to EditAndSelectText for the corresponding columns.
and execute grid.PerformAction(UltraGridAction.EnterEditMode) (see my sample).
In OnBeforeExitEditMode event we need to return CellClickAction.RowSelect for the corresponding columns.
Hi Alex/Mike
I'm having the same problem.
Alex - I didn't understand your reply. Did you find a work around for this problem? Double click on my MaskedEditor cells fails to enter edit (it enters than pops back out) but works on the default text editor.
Mike