Cloning panel primitives and other components

Post and discuss new components that you have created.
Post Reply
BenR
Matrix Staff
Posts: 1707
http://meble-kuchenne.info.pl
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Cloning panel primitives and other components

Post by BenR »

Hello,

One of the powerful features of Flowcode is the ability to clone panel primitive and other components. An example of this in action is the WS2811 component that generates the chained together LEDs on the panel in 1D, 2D and 3D matrices and allows for powerful simulation capabilities.

I've recently made a small demo program to show how to take a component and clone it a number of times and then how to access the properties of the cloned components.

The demo siply takes a hidden static text component named "Clone" and uses this as the master for the clone. All of the features of the component are copied into the clones including the current property settings and location on the panel. The clones are made visible and moved to create a vertical list of static text components. The clones are rebuilt whenever a property change event occurs e.g. changing the number of clone items.

ClonePanel.jpg
ClonePanel.jpg (22.79 KiB) Viewed 2012 times

In the main macro the static text clones are provided a randomised text value to demonstrate controlling the properties of the clones. This could be the colour of a primitive or any other component property.

CloneDemo.fcsx
(25.86 KiB) Downloaded 187 times

Debug information is available via the Component Debugger window when the debug property is set to Yes. This simply highlights how the DeleteClones and GenerateClones component macros function.

CloneDebug.jpg
CloneDebug.jpg (38.65 KiB) Viewed 2012 times

You cannot call the component macros of the cloned items just yet so it won't work for everything but hopefully this will prove useful for some component creation ideas.

Post Reply