Difference between revisions of "API Component.GetInstance"

From Flowcode Help
Jump to navigationJump to search
(XML import of API auto-gen)
 
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
wiki page name
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
==ComponentGetInstance==
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetInstance'''
 +
|-
 +
| colspan="2" | Gets the type-instance of the component, >= 1 is valid 
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE
 +
| width="90%" | Target
 +
|-
 +
| colspan="2" | The component to read the instance from 
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
Gets the type-instance of the component, >= 1 is valid
 
----
 
  
===Parameters===
+
==Detailed description==
''[[Variable types|HANDLE]] Target''
+
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.
:The component to read the instance from
 
:''The default value for this parameter is: '''''this'''
 
  
===Return value===
 
[[Variable types|ULONG]]
 
  
Returns the type-instance of the component, >= 1 is valid
+
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 [[Component Tree|tree]].
  
===Detailed description===
 
''No additional information''
 
  
===Examples===
+
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.
====Calling in a calculation:====
+
 
 +
 
 +
==Examples==
 +
===Calling in a calculation===
 
* Declare a variable 'result' of type ULONG
 
* Declare a variable 'result' of type ULONG
* Add to a calculation icon: result = ::Component.GetInstance(target)
+
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Component.GetInstance(target)</pre>

Latest revision as of 11:54, 16 January 2023

Fc9-comp-macro.png GetInstance
Gets the type-instance of the component, >= 1 is valid 
Fc9-h32-icon.png - HANDLE Target
The component to read the instance from 
Fc9-u32-icon.png - ULONG 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)