Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How to change user's default text color?


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

Recommended Posts

Posted

I'd like to put two buttons at the bottom of a data-entry layout to:

>>> Set Pen Color Black <<< . . . . . >>> Set Pen Color Red <<<

After clicking on one of them, all text that the user types from that point is stored/displayed in that color, regardless of the particular field being typed into. Basically, it's altering the FMP runtime's default text color.

Is there a straightforward way to do this?

Posted

Hi

yes, it's possible...

but I wish for you that your record has no more than 3 or 4 fields !

The trick is an autoenter/replace calculation into the field's definition.

(and it will work only for Text fields, not Number neither Date)

Posted

Thanks for the quick response.

After reading up on Auto-enter Calculations -- and then trying an example -- I was able to apply a new color AFTER tabbing off of the field. In other words, after selecting the Red Pen (with my button), the text was black as I typed it in, but changed to red as I tabbed to the next field.

Is there a way to make the text red as the user types it in?

Posted

Nice job, comment.

Nice your use of Get ( ActiveSelectionStart ) !!

Trim can't help to eliminate the double spaces...

but if the script step becomes:

Insert calculated result[TextColor ( "|" ; Get ( ScriptParameter ) )]

and there is an autoenter/replace calc:

Substitute ( Text; "|" ; "" )

there will be no more double spaces.

Posted

Yes, but meanwhile the user is annoyed by a vertical bar that he/she didn't type. At least a double space doesn't stick out so. It would be possible to set the field to auto-enter TrimAll() upon exit - assuming no one would want to enter double space on purpose.

Posted

the use of the vertical bar isn't so bad to look and can make the changes applying INTO the same word too.

For example:

black tex[color:red]|t red now.

becomes ( on field exit):)

black tex[color:red]t red now.

Posted

the use of the vertical bar isn't so bad to look

Well, that's a matter of opinion. It certainly isn't mine. One thing is sure, it does not look like a polished, professional solution (and neither does double space).

Posted

Hi comment

Now your IDEA is working better (see attachment) ! Real Black and Red text without double spaces !!

(it is also good for numbers with 8 digits plus periods, commas and minus sign)

Without AutoEnter and still without reference to a particular field !

BTW your profile says Dev 7 and so does mine, but your IDEA will work only with 8 :)

Pen.zip

Posted

Hmmm... that is strange... I tried that but it didn't work: it kept reverting to the previous color, as if it erased the 'change color' mark. Well, never mind, as long as it works now. Well done.

BTW, it can be done in v.7 without a problem. But the number field is problematic.

Pen.fp7.zip

Posted

I see...

FM7 is even better than 8 (no flash when you change Pen color)...I'm guessing why !

For the number field, it will show colors only if formatted as "General" ( it seems )

And thank you !

Posted

Ooops, I found a problem: if you place the cursor in the middle of text, the script will "eat" a character. I thought I found a bug, but after reading the help it turns out it's a "feature", so it was my mistake from the start.

I have fixed this - see the notes inside the script.

Pen.fp7.zip

Posted

WOW!

I just checked back in and downloaded the file. What a great solution! This should definitely be put in the Tips & Tricks section.

Thanks very much to both of you.

This topic is 6857 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.