We have a WinTree in FreeForm ViewStyle that has a cell with an embeddable editor that is is an UltraTextEditor. In the AfterCellExitEditMode event of the WinTree, I set the value of this behind-the-scenes business enitty class property that is associated (not through databinding) to what they entered in the cell.
However, this business entity class property might format the given value to something else (for example they enter in 5.9999 and I want to actually round it to 6.0 - a simple example, it is actually more complicated than that where I can't use built-in formatting strings). What happens is that the business entity will throw an event that the control that the WinTree sits on catches and modifies the cell appropriately to the formatted value.
This works fine when this formatting event does't happen within the chain of events of the actual cell that is being 'formatted' is being edited via the UI. However, when in the process of editing it actually ignores the new formatted value.
So psuedo-code looks like:
Private Sub tvwMaterials_AfterCellExitEditMode(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.AfterCellExitEditModeEventArgs) Handles tvwMaterials.AfterCellExitEditMode
Case "Size"
End Select
End Sub
...changing businessEntity.Size will eventually lead to this piece of code where I'm trying to change the same cell value:
node.Cells("Size").Value = businessEntity.Size /*This businessEntity.Size value is different than what the typed in cell value was above*/
This same code where I'm changing the cell value works if initiated from something else besides the AfterCellExitEditMode event of the same cell.
Hopefully this made sense. Should there be a different event where I should be updating my business entity object appropriately or a different method of updating the cell? I've tried trying to update the EditorResolved property (using BeginEdit) but that didn't work. Should I be trying to hook up against a specific UltraTextEditor event to do my updating (although this would still be in the 'chain' I think)? Actually not even using an Embeddable Editor still has the same problem.
Thanks in advance for any insights.
-David
Bueler?...Bueler?
No takers on this one? I guess it is off to official support.
Hi David,
So basically what you are doing here is setting the Value of the cell twice in a row. I wonder... does it make any difference if you just do this as two lines of code one right after the other instead of setting it the first time, which fires an event whose handler sets the value again? Obviously, that's not a solution to the problem, but the results might be interesting. I suspect if you just set the cell value twice, it will work okay, but it's some sort of timing issue with setting it and then setting it again inside an event handler.
One thing you might try in order to get around the issue is using a BeginInvoke, either to set the value the first time (thus triggering the whole series of events) or to set the value the second time (possibly causing a delay so that the processing of the first set finishes before the second one takes place).
Mike, thanks for writing back. Unfortunately setting the cell value right after setting the value of the business object in the AfterCellExitEditMode event does not do the trick either. It seems like I have to be totally out of the AfterCellExitEditMode event for anything to show up in the cell from a non-visual entry standpoint.
I'll play around with using BeginInvoke to see what that gets me.
In your estimate do you think this would qualify as a bug that I should escalate?
Thanks.
dpalau said:In your estimate do you think this would qualify as a bug that I should escalate?
Well, it's a gray area. It might not be possible to do what you want inside these events. But if you are still unable to get it to work, I'd recommend creating a small sample project that demonstrates the issue and Submit an incident to Infragistics Developer Support. They can hopefully find a workaround or report it to the developers to 'fix' if it's determined to be a bug.