gui.getComponentFromInstance

Get the handle from an instantiated component.

Prototype

  1. hComponent = gui.getComponentFromInstance ( hInstance, sComponentIdentifier )

Description

We need this function because getComponent cannot determine for instance which editbox you want if you have 3 instances with an editbox inside.


Parameters

hInstance - instance handle
sComponentIdentifier - component identifier string you are searching for


Return values

hComponent - handle to the component associated with the identifier string, or nil


Sample

  1. function onPropertyViewControlColorSliderRGBChanged ( hView, hComponent, nValue )
  2.  
  3. local hInstance = gui.getParentComponent ( hComponent )
  4.  
  5. local hSliderRed = gui.getComponentFromInstance ( hInstance, "red" )
  6. local hSliderGreen = gui.getComponentFromInstance ( hInstance, "green" )
  7. local hSliderBlue = gui.getComponentFromInstance ( hInstance, "blue" )
  8. local hButton = gui.getComponentFromInstance ( hInstance, "button" )
  9.  
  10. -- etc.

Available since ShiVa 2.0