API Component.GetInstance: Difference between revisions
Appearance
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;" align="center"" to "width="10%" align="center" class="mtx-class-macrohead"" |
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead"" |
||
| Line 2: | Line 2: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetInstance''' | ||
|- | |- | ||
| colspan="2" | Gets the type-instance of the component, >= 1 is valid | | colspan="2" | Gets the type-instance of the component, >= 1 is valid | ||
Latest revision as of 14:11, 13 July 2026
| GetInstance | |
| Gets the type-instance of the component, >= 1 is valid | |
| Target | |
| The component to read the instance from | |
| Return | |
Detailed description
A components instance is a number referring to how many occurrences of a component exist before this one, including itself. The number is 1 if the component is the first of its type to be added.
This instance number is irrespective of the depth of a component - a component of the same type as the Target is still considered even if it is embedded deep in some other components tree.
Note this call relies on a match of the components GUID, so built-in component types (such as shapes and groups) do not have an instance and it will return zero.
Examples
Calling in a calculation
- Declare a variable 'result' of type ULONG
- Add to a calculation icon:
result = ::Component.GetInstance(target)