Lingo Dictionary > O-R > ref

 

ref

Syntax

chunkExpression.ref

Description

Text chunk expression property; this provides a convenient way to refer to a chunk expression within a text cast member.

Example

For example, without references you would need statements like these:

member(whichTextMember).line[whichLine].word[firstWord..lastWord].font = "Palatino" 
member(whichTextMember).line[whichLine].word[firstWord..lastWord].fontSize = 36 
member(whichTextMember).line[whichLine].word[firstWord..lastWord].fontStyle = [#bold]

But with a ref property you can refer to the same chunk as follows:

myRef = member(whichTextMember).line[whichLine].word[firstWord..lastWord].ref

The variable myRef is now shorthand for the entire chunk expression. This allows something like the following:

put myRef.font
-- "Palatino"

Or you can set a property of the chunk as follows:

myRef.fontSize = 18
myRef.fontStyle = [#italic]

You can get access to the string referred to by the reference using the text property of the reference:

put myRef.text

This would result in the actual string data, and not information about the string.