Cloning panel primitives and other components

Post Reply
Matrix Staff
Posts: 683
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 137 times
Been thanked: 213 times

Cloning panel primitives and other components

Post by BenR »


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 (22.79 KiB) Viewed 439 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.

(25.86 KiB) Downloaded 73 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 (38.65 KiB) Viewed 439 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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel

Post Reply