25-07-2012 12:21 PM
Hi !
I would like to add a macro on the MetaAssociation between a GUI Element and a GUI Event.
A GUI Element has always a GUI Owner and when I Connect a GUI Event to a GUI Element, I want to put automatically the property GUI Owner (of the GUI Event) with the same value of the GUI Owner of the GUI Element.
I read the documentation about Calculated attributes but I don't find this kind of macro
How do I Proceed ?
I put a macro on the MetaAssociation between Element and Event but i d'on't really know to begin
Thanks for your help,
Sandrine
Solved! Go to Solution.
26-07-2012 11:58 AM
A calculated MetaAttribute is just that, a MetaAttribute, not a MetaAssociation.
Normally, you have a MetaAttribute (you'll create a new one) on a MetaClass (in your case, GUI Event). If you explore the MetaAttribute and display the empty collections you can add a macro that will be initialized with code to help you code your calculated MetaAttribute. In your case, the result could be either "" or the name of the GUI Owner but that is not of importance really. What is important is the calculation in the macro and the fact that it permits you to access data and automate actions.
In this macro, with GetCollection, you can access the GUI Elements to which he is attached then with another GetCollection, you can access the GUI Owner owner of the GUI Element and with a Add you can connect the GUI Owner to the GUI Event.
Be attentive to multiplicity and integrate that in your algorithym. Can a GUI Event have more than one GUI Element? Can a GUI Element have more than one GUI Owner? In the case of more than one GUI Owner in the end, which do we link? All? The first? You need to think of all of the possible situations.
Perhaps there are more than one possible solutions, but if I were in your situation, that is what I would do (not use a macro linked to a MetaAssociation, but use the macro attached to a MetaAttribute to perform actions.
Regards,
Leslie