Create Tag Help

Gruckman 7 years ago updated by icahill (Administrator) 7 years ago 3
How do you make a create action that will make a panel every time it is pressed?
I want to make a button that will create a new panel every time it is pressed that has new attributes. Each panel needs to have its own actions as well.
The create tag is used to build a class on the fly based on a triggered action. In your scenario you would need to create your panel(s) as a class with variable content. (see Classes Tutorial).

Then on your button you can add an onclickup to trigger an action that will create your class. A create tag essentially takes the place of the object tag when using classes.

Because you require that your created panels have different content, you may have to determine several different create tags and wrap them in a randomgroup tag within your action to allow for different panels to get created at random.

<class name="panel">
<panel name="[param:name]" width="100%" height="100%" onclickup="[param:action]"></panel>

<panel name="button" width="40" height="40" background="ff0000" onclickup="create"></panel>
<panel name="container" alias="CONTAINER" width="90%" height="90%" valign="bottom"></panel>

<action name="create">
<create class="panel" name="1" onclickup="action1" target="CONTAINER"/>
<create class="panel" name="2" onclickup="action2" target="CONTAINER"/>
<create class="panel" name="3" onclickup="action3" target="CONTAINER"/>
Is there a way to make the actions in a randomgroup tag happen in order for each time it is activated? Or is it possible to make the created panels float so that they do not overlap?
To perform action in chronological order, you would want to use a sync tag. This would perform everything in a single action trigger though. Randomgroup will only perform one per trigger.

If you don't want your panels to overlap, consider putting them into a pager when you create them, that way they will fall in line.