PDA

View Full Version : underline dynamic text


Peter_Chea
07-08-2003, 02:23 PM
How do I underline a dynamic text?
<text datapath="name/text()" onclick="classroot.parent.openTab(classroot,true)" >
<method event="ondata">
var name = this.datapath.getXPath("name/text()");
this.setText("<u>" + name + "</u>");
</method>
</text>

antun
07-08-2003, 02:38 PM
A good way would be to overwrite the applyData() method of the text field (you could write a class that did this):


<canvas debug="true">
<dataset name="myData">
<myRoot foo="bar" />
</dataset>

<text datapath="myData:/myRoot/@foo">
<method name="applyData" args="d">
this.setText( '&lt;u&gt;' + d + '&lt;/u&gt;' );
</method>
</text>
</canvas>


Note use of &amp;lt; and &amp;gt; instead of < and >.

-Antun

Peter_Chea
07-08-2003, 02:56 PM
Thanks Antun, it work prefectly.

dougpoirier
01-10-2007, 11:13 AM
I just spent 15 minutes figuring out that inputtext doesn't support the underlining/html formatting.

This is, most likely, by design.

Once I switched the component from inputtext to text, it worked fine.

I hope this saves someone else 15 minutes. :)

DougP