Setting font in a text box
I have a text box in which entry can be from the keyboard or by pasting. The past can be in any font. How can I get FM to change the font to a given font u[on entry?
Add this auto-enter calculation:
TextFormatRemove ( Self )
And clear the "do not replace existing value..." check box.
Then select the field object while in layout mode and specify a font for it.
Looked good but did not work. Pasted data remained in original font.
Then you haven't set up the auto-enter calculation correctly. This function strips out all formatting that might get pasted along with the text.
Did you perhaps forget to clear the "do not replace existing value..." check box?
Take a look at attachments.
Looks good, but I forgot to mention that this corrects things for new data entry into the field. It won't automatically strip it out of existing records. For that you'll need Replace Field Contents as described in your other thread.
It does not seem to work if you are pasting from another application. There should be a way.
Someone must know what is going on. Please help!
OK here is what I found. Use the TextFormatRemove as suggested. When you paste into a field use Paste Text Only.
To fix existing fields to get to the layout font for all do the following:
Click on the field in Browse Mode.
From the Records Menu choose Replace Field Contents.
In the dialog box choose Replace With calculated Result.
Enter TextFormatRemove(name of field) best to choose name of field from Current fields list.
Close Options and hit Replace.
All records will now have the format specified in the layout.
If you use Paste Text Only, you don't need the auto-enter calculation. I've used this calculation any number of times and have recommended it to many others. In fact, I learned it from others here in this forum. So it does work.
If pasting text into your field does not result in the formatting being automatically removed, then something strange is going on here.
If you like, let me know the version of FileMaker that you are using and I'll post a down load link to a very simple demo file and you can test it to see if it works for you and can compare what you have tried to set up to it to see if there are any differences.
Iam using FM 13. I tried both an existing record and a new record. Paste just pastes the font of the pasted text.I is just a simple text field.
Did not work in FM 10 either. I am talking about pasting into a new or existing record.
Please compare what you have to this demo file: https://dl.dropboxusercontent.com/u/78737945/TextFormatRemoveDemo.fmp12
As an example, I can open MS Word and copy text with multiple fonts, colors, and styles applied. When I paste it into the text field that has the TextFormatRemove ( Self ) calculation, it strips out all these formatting details and then the example copies of the field each display text with the styles that I have specified in Data Formatting at the layout level.
I see what is going on. The text is not changed until you hit return, enter, or click on another field. Makes sense. I guess we got it. Thanks.
Yep, until you exit the field, FileMaker doesn't know if you are finished entering/editing data in the field.
Retrieving data ...