+1
Beantwortet

Including a variable in an Alert string.

Luska72 vor 11 Jahren aktualisiert von icahill (Administrator) vor 11 Jahren 1
What is the best way to add an existing variable into a string(concatenation)? An example of what I am trying to achieve would be:


<alert title="yPos!" message="object:PANEL1.ypos"/>.


The goal is to make the position pop up, not actual text in the string.
In your example above you need to wrap your object in brackets: [object:PANEL1.ypos] that should return the correct value.

If you are just trying to return positioning, then you could also use _RW-touchedy which is sort of a built in variable. In this example the alert doesn't need a target because the action is coming from the actual panel you want the value for. :

<wire>
<main>
<panel name="1" width="30%" height="30%" background="ff0000" ondragging="show" draggable="yes"></panel>
</main>
<actions>
<action name="show">
<alert message="_RW-touchedx, _RW-touchedy"/>
</action>
</actions>
</wire>