Hi... I have an already activated cell which is not in Edit Mode...
I'd like that when the user clicks on that cell a second time (not double click), the cell switch to Edit Mode...
Hi all,
could we go back to the first question on this thread?
joz said: I have an already activated cell which is not in Edit Mode... I'd like that when the user clicks on that cell a second time (not double click), the cell switch to Edit Mode...
I have an already activated cell which is not in Edit Mode... I'd like that when the user clicks on that cell a second time (not double click), the cell switch to Edit Mode...
Mike says: I'm pretty sure that if the cell is selected, this will happen automatically.
I thought that too, but it doesn't. I have CellClickAction = CellSelect and the column is a simple text column. It goes to Edit mode if I press F2.
Which are the other settings that affect this behavior?
Okay, well, if I am wrong about that then you'd have to code it youself. What you could do is handle the MouseDown event and determine which cell was clicked and if that cell is selected, enter edit mode.
So there are 2 tricky parts:
Q1) How do you determine what cell the mouse is over?
A1) HOWTO:UltraWinGrid Mouse Position and Cell Identification
Q2) How do you enter edit mode on the cell once you find it.
A2) Use the PerformAction(EnterEditMode) method.
Thanks Mike, another tricky part is to distinguish between the first and second click.
On mouse down, the cell is already on the first click selected.
My code:
{
object cell = UIElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridCell));
}
This has the outcome that the cell goes in edit mode already on the first click, which is not what I want.
That's easy. You don't really care about the number of clicks, you only care if the cell is already selected. So just check the cell.Selected property.
I already do that, see my code. The problem is: in MouseDown the cell is always selected.
Oh, sorry. So the cell is selected before the MouseDown fires - that's unexpected.
In that case, I guess you need to store the last cell that was clicked in a form-level variable so you can track when it gets clicked the second time.
Yeah, I was hoping I can avoid that inelegant solution.
Thanks for your time, Mike.