Problems Changing Text Size in Field if Pasted From Another App.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 7
- Joined: Tue Mar 09, 2021 6:37 pm
- Location: Massachusetts
Problems Changing Text Size in Field if Pasted From Another App.
I have a field that I keep notes in. I have two buttons that are used to increase and decrease the size of the font in the field. These work fine for the entire field and any text I type into the field. My problem is if I paste text into the field from another app, even though it is completely editable in my field, the size of the text doesn’t change with the buttons I have.
With some of the originally typed text in the field and some pasted text, the text typed into the field changes, but the additional text pasted from a different app stays the same. This occurs whether or not some or all of the text is selected.
What can I do to control the size of all of the text in my field?
With some of the originally typed text in the field and some pasted text, the text typed into the field changes, but the additional text pasted from a different app stays the same. This occurs whether or not some or all of the text is selected.
What can I do to control the size of all of the text in my field?
Re: Problems Changing Text Size in Field if Pasted From Another App.
That has happened to me and the solution I found is:
that solves it for me.
Code: Select all
set the text of field "myField" to the text of field "myField"
-
- Posts: 7
- Joined: Tue Mar 09, 2021 6:37 pm
- Location: Massachusetts
Re: Problems Changing Text Size in Field if Pasted From Another App.
Thank you andresdt. That solved it. How did you ever come up with that?
Re: Problems Changing Text Size in Field if Pasted From Another App.
I don't remember when or how it was, I just know that it has helped me countless times.donbeck@donbeck.org wrote: ↑Sun Apr 11, 2021 3:49 amThank you andresdt. That solved it. How did you ever come up with that?
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Problems Changing Text Size in Field if Pasted From Another App.
I do the same thing sometimes. LC allows you to set text properties on characters in the field and also on the field itself. Character properties override field properties. If the text itself has no properties assigned (size, style, color, etc.) then it inherits the properties of the field.
Pasting text preserves the properties of the text from the original app. You could have changed the size by selecting all the text manually and setting the text size. But it's easier to just remove all the character properties by putting the text into the field from a variable. Text in a variable has no properties, it's just a plain string, so it will inherit the field's text size.
Pasting text preserves the properties of the text from the original app. You could have changed the size by selecting all the text manually and setting the text size. But it's easier to just remove all the character properties by putting the text into the field from a variable. Text in a variable has no properties, it's just a plain string, so it will inherit the field's text size.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Problems Changing Text Size in Field if Pasted From Another App.
@Jacque's post gave me an idea to make a behavior for the fields, which we don't need to keep the format of the original application.
Put the following code in a behavior and set this behavior in your fields.
What is done is that instead of cleaning the format of the field, the format of the clipboard is cleaned.
Put the following code in a behavior and set this behavior in your fields.
Code: Select all
on rawKeyDown pKeyCode
set the clipboardData["text"] to the clipboardData["text"]
pass rawKeyDown
end rawKeyDown