You can use array offsets with a tag that is an array.
For example, you may have a tag (named Tag1) defined as an array of four elements. When using the GENERIC protocol, the tag has an address I1[4]:
Tag1 = I1[4] ->
|
I1
|
|
I2
|
|
I3
|
|
I4
|
Tag1 represents the registers I1, I2, I3 and I4. When Tag1 is used with the Ass() Cicode function it behaves as follows:
- If you associate a value using Ass(hWin, "X", "Tag1", 0) then the substitution string ?X?[0] gives the value in I1.
- If you associate a value using Ass(hWin, "X", "Tag1", 0) then the substitution string ?X?[2] gives the value in I3.
- If you associate a value using Ass(hWin, "X", "Tag1[0]", 0) then the substitution string ?X?[2] gives the value in I3.
- If you associate a value using Ass(hWin, "X", "Tag1[1]", 0) then the substitution string ?X?[2] gives the value in I4. This is because the two offsets are added together to determine the final offset within the array variable.
- If you associate a value using Ass(hWin, "X", "Tag1[2]", 0) then the substitution string ?X?[2] gives the error #ERR. This is because the sum of the two array offsets gives a position (Tag1[4]) that is outside the bounds of the array.
You can also use array offsets with a tag that is not an array.
For example, you may have a tag (named Tag2) defined as a single value. When using the GENERIC protocol, the tag has an address I1:
When Tag2 is used with the Ass() Cicode function, it behaves as follows:
- If you associate a value using Ass(hWin, "X", "Tag2", 0) then the substitution string ?X?[0] gives the value in I1. This is because a non-array tag is equivalent to an array with one element.
- If you associate a value using Ass(hWin, "X", "Tag2[0]", 0) then the substitution string ?X?[0] gives the value in I1. This is because a non-array tag is equivalent to an array with one element.
- If you associate a value using Ass(hWin, "X", "Tag2", 0) then the substitution string ?X?[2] gives the notification #ERR. This is because a non-zero offset cannot be applied to a non-array tag.
- If you associate a value using Ass(hWin, "X", "Tag2[0]", 0) then the substitution string ?X?[2] gives the notification #ERR. This is because a non-zero offset cannot be applied to a non-array tag.
- If you associate a value using Ass(hWin, "X", "Tag2[1]", 0) then the substitution string ?X?[2] gives the notification #ERR. This is because a non-zero offset cannot be applied to a non-array tag.
- If you associate a value using Ass(hWin, "X", "Tag2[2]", 0) then the substitution string ?X?[2] gives the notification #ERR. This is because a non-zero offset cannot be applied to a non-array tag.