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.

Copy-'n'-Paste Text Color problem in Themes

Featured Replies

Howdy, all:

I'm using a custom theme in a solution that has presents text color in white. Fine. The problem arises when a user clicks the Copy button in the solution that copies a field's contents: when pasted in another app--like TextEdit or WordPad--the text is white because they accept the style the text was created in.

I'm having a devil of a time trying to code a script so that it temporarily turns the field's text black--which I've managed to do using Conditional Formatting and setting a global number field ("1" = black text, "0" = white text) as a condition--then copy it so it can be pasted as black text elsewhere. I don't (readily) see a script command that strips away a style so only plain (black) text is copied.

Any ideas? TIA for your help!

There are "remove text formatting" and "text style add" calculations which would apply to what you're doing.

I use a Custom Function called Trim 4 by Ray Cologon Here and the TextFormatRemove most of the time. You can do this by Auto Enter on the filed, using the Calculation with the "Do not replace existing value of field (if any) Deselected.

Trim4 ( TextFormatRemove ( Self ) ) or Trim4 ( TextFormatRemove ( yourField ) )

You could modify this and use in a script or the Menu item of Replace Field Content.

HTH

Lee

  • Author

Thank you both--great ideas!

Lee, I just couldn't get Trim4 to work--my density must be getting in the way. I've attached a quick-'n'-dirty FMPA v12.x test file with it where the Description field is a text field, Description 2 is a hard-coded calc with Trim4, and Description 3 is a text field with the custom function assigned.

I must be missing something REALLY obvious since for such a simple CF it should work. (I'd wager it's the CF's parameter setting if I were a betting man.) Go ahead and club me over the head. : )

test.fmp12.zip

It only removes leading and trailing white spaces, tabs and returns. It doesn't remove those things within the paragraphs. You would need to replace, or substitute these thing out. I think there are a couple of CFs for this too.

Try adding some spaces and returns before and after your text and watch the 2nd field.

I meant for you to use the Trim4 in the Auto Enter for the field that the text is being pasted into. I have modified your example to show this.

Lee

test_Mod.fmp12.zip

  • Author

Thanks, Lee--I appreciate it!

Create an account or sign in to comment

Important Information

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

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.