Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to change user's default text color?

Featured Replies

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?

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)

  • Author

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?

yes, it is possible.

You have to make two layouts and use a custom function: GetRGB() from Michael Horak.

BTW see the attached example

Pen.zip

You could try something like this (attached), but it is not perfect. Why not simply let the user use Filemaker's text formating toolbar?

Pen.fp7.zip

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.

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.

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.

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).

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

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

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 !

Another improvement...

now you can select some words and apply the color.

Pen.zip

:thumbup:

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

:clap:

  • Author

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.

  • Newbies

You can also use the same technique to change the font size of selected type!

Pen_size.fp7.zip

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.