Page 1 of 1
is it possible to have styled text in a field?
Posted: Fri Feb 19, 2010 2:26 pm
by jpottsx1
I've looked at the lessons and tutorials but cannot find out any way of putting styled text into a field from within Runrev. I don't see any formatting opotions such as bold or text size.
Any ideas? Can it be done? Can something like tText be used for this purpose?
Re: is it possible to have styled text in a field?
Posted: Fri Feb 19, 2010 2:47 pm
by BvG
No idea what "tText" is, but there's basically two ways to change the styling of a text wit code.
If you'd have bothered to look into the dictionary for bold, italic or unerline, you'd have found the textstyle property. That property allows for various other styles too. For size and font choices you can see the textfont, and the textsize. You can set parts of a fields text to have various styles. All these properties can also be set on a field or any object higher up in the message path, and are then inherited downwards. So if you set the textstyle of your stack to bold, all text in that stack (that has no individual styles set) will be bold.
Sometimes the styles properties are not powerfull enough, at which point it's neccessary to use the htmltext. The advantage is, that you can create htmltext in a variable, and only then set the htmltext of a field to that. You can't do that with the style properties, as variables do not have properties. Note that htmltext is not html 4.0. It's just similar to html, but rev's own specific implementation that is only similar to the standard html. So make sure to look it up in the dictionary.
Re: is it possible to have styled text in a field?
Posted: Fri Feb 19, 2010 2:57 pm
by bn
Jeff,
you can set a lot of text properties by script. Like
Code: Select all
set the textcolor of word 2 of field 1 to red
or
Code: Select all
set the textstyle of word 2 of field 1 to bold
What you do then is that you change the htmlText of the field. A field has a text property which is the plain ascii text and a htmlText property. Look up htmlText in the dictionary.
If you want to see the htmlText property you can do this:
make a simple stack with 2 fields. You put just some words into field 1. Than you set the textcolor and textstyle with obove scripts. Make a button with
Code: Select all
on mouseUp
put the htmlText of field 1 into field 2
end mouseUp
as it's script. In field 2 you will see some html, which represents the htmlText of your field 1.
In the help menu choose Resource Center. There are some tutorials
e.g.
-> revolution coding -> Text
-> tutorials -> sample scripts -> text-> replacing a text style in a field
I hope this gets you started on this, don't hesitate to ask. It can get rather involved, depending on what you want. It can also be easy if you just want to change some aspects of your text.
regards
Bernd