Jump to content

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


Rich S

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

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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