Jump to content

TextStyleAdd and global fields


This topic is 582 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Howdy all:

I'm flummoxed. The following calculation works fine:

TextSize ( TextStyleAdd ( LABEL_WORKSPACE::Field1__lxt ; Uppercase + Bold ) ; LABEL_WORKSPACE::_g_Field1_FontSize__lxn )

However, when I replace the argument for the style change with a global field that has the same text (Uppercase + Bold),

TextSize ( TextStyleAdd ( LABEL_WORKSPACE::Field1__lxt ; LABEL_WORKSPACE::_g_Field1_StyleChoice__gxt ) ; LABEL_WORKSPACE::_g_Field1_FontSize__lxn )

...it doesn't change the text's format--it remains plain. I looked at the Help page and didn't see anything that says that the argument can't be a field, just that it has to be text.

Am I missing something, or the argument has to be text and not a field?

 

Ciao,

Rich

 

Link to comment
Share on other sites

I think I found a fix: if I stick the field reference inside the Evaluate command, i.e.,

TextSize ( TextStyleAdd ( LABEL_WORKSPACE::Field1__lxt ; Evaluate ( LABEL_WORKSPACE::_g_Field1_StyleChoice__gxt ) ) ; LABEL_WORKSPACE::_g_Field1_FontSize__lxn )

...it works. : P

Link to comment
Share on other sites

27 minutes ago, WF7A said:

Am I missing something, or the argument has to be text and not a field?

The thing is that the argument is NOT text. Texts in calculations are quoted. The styles argument of the TextStyleAdd() function is actually a number - and Filemaker allows you to specify the number using a keyword.  

The keyword Uppercase represents the number 16 and keyword Bold stands for the number 256. The expression:

TextStyleAdd ( text ; Uppercase + Bold )

is the exact equivalent of:

TextStyleAdd ( text ; 272 )

If you want to allow users to specify the styles as text, then you must find a way to transform the text entry into a number before you pass it to the TextStyleAdd() function - as it seems you already did while I was writing this.

 

Link to comment
Share on other sites

This topic is 582 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.