TagsMe™ GUI Forum
Username:
Password:
Pages: [1]
  Print  
Author Topic: HOW TO use expressions to link objects positions  (Read 2080 times)
noe
Administrator
Hero Member
*****
Posts: 537



WWW
« on: May 22, 2009, 07:56:00 am »

TagsMe™ allows to use expressions when setting an attribute or property. That allow us to
access object's values and apply them on another object.
To set an attribute with an expression we use the following syntax:

Attribute=”$(expression)”

For example, suppose that we want to place an image just below another one. First image has
y=20 and height is 50 pixels. For setting second image below first one, we only have to set
y=”$(image1.y+image1.height)”. It is very important if we want to use expressions, that all
objects that participate on it have set their name attribute. It is the only way TagsMe™ can
access those properties.

Code:
<Image name="image1" file="/res/image1.png" x="90" y="20" anchor="TOP-HCENTER" />
<Image name="image2" file="/res/image2.png" x="$(image1.x)" y="$(image1.y+image1.height)" anchor="TOP-HCENTER" />
Logged
pushand83
Newbie
*
Posts: 5


Email
« Reply #1 on: June 17, 2009, 10:30:37 am »

Sorry, I'm Spanish so I'll try to explain as can as possible!

Can that expressions be the result that a function returns?? I've seen lots examples of function but I don't know what I have to do for calling them.

This is my code:

<?xml version="1.0" encoding="UTF-8"?>
<TagsME xmlns='http://www.mdtec.net/schema/TagsME' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://www.mdtec.net/schema/TagsME http://www.mdtec.net/schema/TagsME'>
       
    <Module name="MyModule">           
       
       
 
    <Script><![CDATA[         
         private int function()             
             {
               return 20;               
             }       
         ]]></Script>
         
       <Rectangle x="$(function())" y="10" width="50" height="50" fillcolor="325693"/> 
     </Module>
</TagsME>
Logged
pushand83
Newbie
*
Posts: 5


Email
« Reply #2 on: June 17, 2009, 10:31:46 am »

I forget the error:

ERROR(/xml/M_menu.xml)-[SINTAX ]-Object name must be defined as first parameter if you use $(....)
Logged
jose
Administrator
Newbie
*****
Posts: 28



WWW Email
« Reply #3 on: June 17, 2009, 12:49:54 pm »

There are two important key points:

1.- You must define attribute 'name' to Rectangle object:
Code:
<Rectangle name="xxxx"...
Please, read section 3.5 from ScriptMe™ and Other Plugins

2.- 'Script' section must be defined at the end of the Module content.
Code:
<Rectangle name="rect" x="$(function())" y="10" width="50" height="50" fillcolor="325693"/>

<Script><![CDATA[         
         private int function()             
             {
               return 20;               
             }       
         ]]></Script>


Logged
pushand83
Newbie
*
Posts: 5


Email
« Reply #4 on: June 17, 2009, 04:02:21 pm »

Thank very much! No I have other mistake.
   - ERROR(/xml/newmodule.xml)-[UNKNOWN]-Object not found: private int function
An important thing: can I use ScritpME if I'm use 30 free days version?
Logged
jose
Administrator
Newbie
*****
Posts: 28



WWW Email
« Reply #5 on: June 22, 2009, 08:24:59 am »

ScriptMe™ plugin is available to use in TagsMe™ GUI Evaluation version.
Logged
Pages: [1]
  Print  
 
Jump to: