Custom mapped object seems to refer to wrong object
Hi,
I have a complex grid on the rows of which various operations should be performed. One of the specifics of the grid is that it's rows are created lazy and re-used several times, so, say the grid is called myGrid, then myGrid.Rows[i] would return a row which can be the first, second, ... or the last as visible to the user.
The grid rows, however, have a property called OriginalNumber, which corresponds to their "logical" number, what a user would expect: the topmost row has an OriginalNumber of 0, the second has 1 and so on. If I want to select the row the row head of which reads 23, I need to find the row with OriginalNumber of 22.
To be able to work efficiently with various rows of the grid, I created a custom mapping based on one of the rows (TranslationRowControl class). I've customized identifier properties as follows:
- ClrFullClassName: Foo.Translation.TranslationRowControl
- OriginalNumber: 2 (Project Variable, RowOfInterest)
That is, Aliases.Foo.Translation.TranslationRowControl should always refer to the row the OriginalNumber of whic is equal to the value of the project-level variable RowOfInterest.
The problem is that this seems not working. When
- The value of Project.Variables.RowOfInterest is 2 (set in a Jscript function); and
- The name mapping editor (when pausing execution to debug script) shows the following for OriginalNumber: 2 (Project Variable, RowOfInterest)
-- then Aliases.Foo.Translation.TranslationRowControl.OriginalNumber equals to 0 in the watch window, and if I call, for example, the Click() method of Aliases.Foo.Translation.TranslationRowControl, TC will really click the 1st row instead of the 3rd.
What may cause this unexpected behavior? Am I using identifier properties in name mappings for some wrong purposes?
Are you calling
Aliases.RefreshMappingInfo();
after changing the Project.Variable?