Need some guidance here.
Program requirements: -
1. When "Bool Col" checkbox is tick and user click at "String Col", set "Int Col" value to 999.
2. When "Bool Col" checkbox is untick and user click at "String Col", set "Int Col" value to 0 and need the input focus change from "String Col" to "Int Col" to enforce user enter value more than 0.
Problem facing now at 2nd requirement: -
1. The "Int Col" value can be set to 0 but input focus cannot be change from "String Col" to "Int Col"
2. Cannot enforce user enter value more than 0.
Attached is sample application to demo my problem.
Hi,
I'm sorry, but you lost me. I'm not at all clear what you are trying to do here.
If the user needs to enter a value greater than 0 in the "Int Col", then you need to validate that cell before they leave it. You could do this in the BeforeExitEditMode event of the IntCol, or you might also want to use BeforeCellDeactivate or BeforeCellUpdate. But that doesn't seem to have anything to do with the original question.
Hi Mike,
I manage to use BeginInvoke to set the focus.
But I still face 2nd problem, which is user can tab away or left 0 in the "Int Col". But I need user to enter value > 0, that why I had set the Infragistics.Win.UltraWinGrid.ColumnStyle.IntegerPositive for the "Int Col"
I had attached the latest sample application for reference.
Please advice, Thanks.
C
Yes, the idea is when "Bool col" is set to false, then "Int col" data should be set as focus.
The BeginInvoke get executed after the focus change to the "String col", but then it seems like also change the active cell to "String col". If this is the case, I seems like cannot track what is the previous column that had been modified.
I'm not sure I understand what you are trying to do here. I see that when you set the bool col to false, you want to set focus to the Int Col cell.
But using BeforeExitEditMode for this seems like a bad idea. This event is going to fire when the user tries to leave the Bool Col cell, no matter how they do it. They will be unable to click anywhere else in the grid or on any other control in the application that takes focus. Maybe that is what you want, but it seems odd.
Anyway, you cannot set focus to another cell and enter edit mode on that cell from the BeforeExitEditMode event, because there is a cell which is still currently in edit mode and in the process of existing it.
You can probably get around this by using a BeginInvoke to set the grid's ActiveCell and EnterEditMode, instead of doing it from directly inside the event.
Another option would be to use the BeforeRowUpdate event to do your validation and just make sure the user does not leave the row, since the validation you are doing here depends on more than one cell.