Difference between revisions of "API Panel.Position.Set"

From Flowcode Help
Jump to navigationJump to search
Line 31: Line 31:
  
 
===Flowcode example file===
 
===Flowcode example file===
Download [[File:SIMAPI_Panel_Position_Set.fcf]] into Flowcode. In this example, there are two spheres. The red sphere has dimensions of 24h,24w,24d, the yellow sphere has dimensions of 12h,12w,12d. This is an important consideration when using the Set() function because it effectively clones the dimensions and coordinates of the source component.  
+
Download [[File:SIMAPI_Panel_Position_Set.fcf]] and open it in Flowcode v6. In this example, there are two spheres. The red sphere has dimensions of 24h,24w,24d, the yellow sphere has dimensions of 12h,12w,12d. This is an important consideration when using the Set() function because it effectively clones the dimensions and coordinates of the source component.  
  
 
What you will see in this demo is the red sphere move to the coordinates of the yellow sphere and also the red sphere will be resized to that of the yellow sphere. As there are now two objects of exact same dimensions and coordinates the red sphere may look like its dissapeared or you may see both spheres exhibiting some colour collision. The LCD will show the coordinates of both spheres.  
 
What you will see in this demo is the red sphere move to the coordinates of the yellow sphere and also the red sphere will be resized to that of the yellow sphere. As there are now two objects of exact same dimensions and coordinates the red sphere may look like its dissapeared or you may see both spheres exhibiting some colour collision. The LCD will show the coordinates of both spheres.  

Revision as of 16:10, 15 May 2013

<sidebar>API contents</sidebar> Sets an objects position based on a component or pre-defined position

Class hierarchy

Panel

Position
Set

Parameters

HANDLE Dest

The position or component to update

HANDLE Source

The position or component to read from


Return value

This call does not return a value


Detailed description

No additional information


Examples

Calling in a calculation

  • Add to a calculation icon:
    ::Panel.Position.Set(dest, source)

Flowcode example file

Download File:SIMAPI Panel Position Set.fcf and open it in Flowcode v6. In this example, there are two spheres. The red sphere has dimensions of 24h,24w,24d, the yellow sphere has dimensions of 12h,12w,12d. This is an important consideration when using the Set() function because it effectively clones the dimensions and coordinates of the source component.

What you will see in this demo is the red sphere move to the coordinates of the yellow sphere and also the red sphere will be resized to that of the yellow sphere. As there are now two objects of exact same dimensions and coordinates the red sphere may look like its dissapeared or you may see both spheres exhibiting some colour collision. The LCD will show the coordinates of both spheres.

After two seconds the red sphere will re-appear back in it's original location and to it's original size. Just using the set() function alone would have successfully moved it back to it's original coordinates but it would not have resized the red sphere back to it's original dimensions.

To return the red sphere back to it's original dimensions, a clever technique can be used by creating a variable of type Handle. Then using the get() api call we pass a copy of the red sphere's original size and coordinates to this variable. Then use set() api call again this time specifying the variable as the source handle. You can see this clearly in the flowcode example.

The screenshots below show the effect and also highlight the code used by the example.

SIMAPI Panel Position Set Pic1.pngSIMAPI Panel Position Set Pic2.png SIMAPI Panel Position Set Pic0.png