View Full Version : How to write a bold text?
gcsaba2
11-21-2005, 06:19 AM
Hi, I'm new to OpenLaszlo, and I'm currently exploring what it can do. What I'd like is to extend the statictext class with a new kind of text, called boldtext. The difference between statictext and boldtext is that the later's text is in bold.
The way I imagine this should work is to take the text from the parent class, and put it between <b> tags. I tried like this, but didn't work:
<class name="boldtext" extends="statictext">
<statictext><b><text text="${parent.text}"/></b></statictext>
</class>
I guess this is very easy for someone who has more experience with OpenLaszlo. Could someone help me with this one?
Thanks, Csaba
Shelby
11-21-2005, 06:24 AM
You should be able to apply font styles to the static text, like other components.
<statictext fontstyle="bold">Hello World</statictext>
gcsaba2
11-21-2005, 06:43 AM
Hmm yes, that did solve my problem (thanks), but I would like to know this more generally so that next time in the future when I want to override a value I would know how to do that. For example, just right now I'm trying to create a simple one-color border, which I could then put around various components.
I would want to use it like this:
<lineborder>
some stuff here
</lineborder>
So the code would have to look kind of like this:
<class name="lineBorder">
<view bgcolor="black" width="150" height="80">
<view bgcolor="yellow" x="1" y="1" width="${parent.width-2}" height="${parent.height-2}">
* <--- insert code here
</view>
</view>
</class>
You see, I would want to retrieve the value of the tag and then do stuff with it within the class. How can I do that?
gcsaba2
11-21-2005, 06:47 AM
Oops, looks like the code I just wrote there will work if I don't put anything between the tags. Anyway, ignore the code, I'd just like to retrieve the value in a more general case.
Shelby
11-21-2005, 06:53 AM
I'm not sure I'm following what you are asking.
Tags represent objects in Laszlo, and objects can have attributes. Embedding tags essentially creates parent-child relationships with objects. You should be able to retrieve the value of any attribute within an object, either by referencing its name/id or by using its relationship to other objects (e.g. parent.attribute).
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.