StyledText issues

Hello,
I’m trying to set some specific formatting into a TextField (named Autore), the property kAutore holds whatever goes int the field

[code]Var text As String

text = App.kAutore

Autore.StyledText.Text = text
Autore.StyledText.FontName(0, 11) = “Courier”
Autore.StyledText.Size(0, 11) = 15
Autore.StyledText.Bold(0, 11 ) = True
[/code]

I got this coding from one of the examples bundled with Xojo but I keep on getting the following errors:

[i]Intro.Open, line 25 Type “TextField” has no member named “StyledText”
Autore.StyledText.Text = text

Intro.Open, line 25 Type “Int32” has no member named “Text”
Autore.StyledText.Text = text[/i]

The same goes for the other three lines that follow line 25.

What am I missing?
Is this the way to pick a font from the ones I have installed on my Mac?

Thank you for your help

Step 1 is NOT to use text as a variable name. It is a reserved word in Xojo.

Var text As String
is a very bad idea.

try

Var someText As String

There are some other problems, but this is a start.

Step 2: StyledText is used in TextArea not in TextField

So create in your window a TextArea that you could call: Autore
In the sample code, I am assigning the App property: kAutore.

[code]Var someText As String

App.kAutore = “Now is the time for people to unite against cornavirus”

someText = App.kAutore

Autore.StyledText.Text = someText.ToText
Autore.StyledText.FontName(0, 11) = “Courier”
Autore.StyledText.Size(0, 11) = 15
Autore.StyledText.Bold(0, 11) = True[/code]

I used the code fragment

…someText.ToText

It is not necessary, really, but Xojo can be “funny” with Text and String so I explicitly make it a Text value.

someText is declared as a string.

Great, I fixed it.
Thank you both for your help