Problems with htmltext [solved]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
ittarter
Posts: 151
Joined: Sat Jun 13, 2015 2:13 pm

Problems with htmltext [solved]

Post by ittarter » Mon Oct 16, 2017 5:24 pm

Hello,

I'm having problems with htmltext of a field.

It appears that this property is not being automatically updated when I copy-paste a new, formatted text into the field.

For example, if I set the htmltext of a field to empty, the visible text of the field doesn't change. And if I do

Code: Select all

put the htmltext of fld x
then I get <p></p>

Or if I highlight the text and delete it (or go into the property manager and delete the text from the appropriate tab), and put in a NEW formatted text, if I ask for the htmltext of the field, it gives me the old htmltext of the OLD text. It didn't update the htmltext even when I updated the text and the text is formatted!

Obviously I can set the htmltext of the field to something, but if I'm pasting text from another application, why am I not able to grab the htmltext of it so that I can store it as a variable?

Code: Select all

put the htmltext of fld "result" into tData
put tData into tArray[tName]
Last edited by ittarter on Wed Oct 18, 2017 5:25 am, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9665
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Problems with htmltext

Post by dunbarx » Mon Oct 16, 2017 6:05 pm

Hi

Unless you set the htmlText of a field to empty, simply replacing styled text with new text will retain, apparently, the LAST style.

Try this. In a new field, enter "RRR GGG". Change the color of "RRR" to red. Set the color of "GGG" to green. Pretty, no? Empty the field and type a two different words. They are all green.

It would be too much to expect the two new words to capture the old two-word htmlText, since what would such a scheme do with either one new word or fifty? So maybe this is expected behavior?

Craig Newman

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Problems with htmltext

Post by bn » Mon Oct 16, 2017 6:33 pm

Hi Ittarter,

I can not reproduce what you are seeing in LC 8.1.6 gm nor in 8.2.0 DP2 on a Mac

formatted text from an external application when pasted and queried for the htmlText of the field gives the htmlText of the field.
Then I select the text of the field and paste some different formatted text into the field. The htmlText of the field reflects the newly pasted formatted text.

What version of LC do you use? What operating system?

Kind regards
Bernd

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9665
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Problems with htmltext

Post by dunbarx » Mon Oct 16, 2017 7:55 pm

Hmmm.

I thought you were typing into the field. Must read more carefully...

Like Bernd, if I have a field with two words, each a certain color, and then paste new styled text either into or after the text of that field, the style of the new text is preserved.

Craig

ittarter
Posts: 151
Joined: Sat Jun 13, 2015 2:13 pm

Re: Problems with htmltext

Post by ittarter » Mon Oct 16, 2017 10:21 pm

bn wrote:
Mon Oct 16, 2017 6:33 pm
What version of LC do you use? What operating system?
LC 8.1.2, Windows 10

ittarter
Posts: 151
Joined: Sat Jun 13, 2015 2:13 pm

Re: Problems with htmltext

Post by ittarter » Mon Oct 16, 2017 10:25 pm

dunbarx wrote:
Mon Oct 16, 2017 7:55 pm
Like Bernd, if I have a field with two words, each a certain color, and then paste new styled text either into or after the text of that field, the style of the new text is preserved.
Let me try to explain in a different way.

I've set the htmltext of fld x using a variable with html-formatted content. But then, if I copy-paste over that old resulting text with NEW html-formatted content from an outside application (e.g. MS Word, bold, centered, Verdana, 14-size font, various spacing/margins etc.), and then ask for the htmltext of the field, I STILL get the old htmltext that I set before. Thus, it appears that the htmltext property isn't updating.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Problems with htmltext

Post by bn » Mon Oct 16, 2017 10:59 pm

Hi Itarter,

I tried to follow your recipe again and it does work for me.

I seem to recall that the clipboard on Windows 10 was somehow not working correctly, I don't remember the exact version nor what exactly was not working properly.

Could you try what you are doing in a more recent version of LC e.g 8.1.6 or later and see if it works then.

Other than that I am out of ideas.

Kind regards
Bernd

ittarter
Posts: 151
Joined: Sat Jun 13, 2015 2:13 pm

Re: Problems with htmltext

Post by ittarter » Tue Oct 17, 2017 10:23 am

EDIT: Never mind, there was another field "result" in a group on the same card.

Whoops.

That'll teach me to use generic names for my objects.... :roll: :shock: :roll:

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”