copying and pasting from/to fields not working?

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: copying and pasting from/to fields not working?

Post by jacque » Wed Dec 07, 2016 9:12 pm

I'm not positive but I believe background colors in web pages would be controlled by CSS and LiveCode doesn't support CSS.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: copying and pasting from/to fields not working?

Post by FourthWorld » Wed Dec 07, 2016 10:21 pm

jacque wrote:I'm not positive but I believe background colors in web pages would be controlled by CSS and LiveCode doesn't support CSS.
Seems I definitely missed something. I thought this thread was about pasting styled text into a WYSIWYG text editor. The web, of course, is all plain text. Sometimes styling can be done inline, sometimes with CSS, but all styling instructions are written in plain text.

Where would pasting come in? What is the target program? I've seen the OP refer to WordPad, Word, etc., but not a web tool.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: copying and pasting from/to fields not working?

Post by dunbarx » Wed Dec 07, 2016 11:12 pm

Richard.
Seems I definitely missed something. I thought this thread was about pasting styled text into a WYSIWYG text editor
Nope. That is how it started. I also, er, lost the thread when the web stuff appeared. Feature creep?

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: copying and pasting from/to fields not working?

Post by jacque » Wed Dec 07, 2016 11:20 pm

It is about pasting into another app. LC automatically includes styled text when copying, as well as all other keys in the clipboard array including HTMLtext. The OP wants background color around some text, and the tags LC uses for that are not standardized, so everything except background color gets pasted.

HTML is involved because that is where you can see, and possibly manipulate, the styling tags. The goal is still to paste content as it appears in LC, but I don't think background fill color is possible without some manipulation of the clipboardData.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: copying and pasting from/to fields not working?

Post by FourthWorld » Thu Dec 08, 2016 12:49 am

When I paste into LibreOffice I see everything I would expect with text styles (bold, italic, text color, etc., even superscript). But I don't see the background color carried over.

I do see the bgcolor tag in the htmlText though, and pasting within LC brings that attribute along for the ride like all the others.

Here's the script I used:

Code: Select all

on mouseUp
   set the backgroundcolor of word 2 of fld 1 to yellow
   select text of fld 1
   copy
   put the clipboardData["htmlText"]
end mouseUp
I tested this on Ubuntu, and I haven't dug into the Gnome APIs to see if the background color should be supported.

My guess is that it's not commonly a part of the OS-provided clipboard structures.

The OP may need to reconsider the design if it must rely on the OS clipboard.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: copying and pasting from/to fields not working?

Post by AxWald » Thu Dec 08, 2016 9:44 am

Hi,

I tried this, just for fun. Win 10-64 pro, LC 6.7.10 (same results with 8.1).

Have a look:
typo.jpg
an example
Lacking MS Office I tried my trusty Softmaker Office*), and it worked like a charm. Tried WordPad then, worked too.
MS Expression Design/ Web, Google Docs (someone really using this crap?) all pasted plain text, RagTime 5 (that uses RTF here) ignored the backcolors but showed the other formats.

Reading above that formats came over (but no backcolors) leads to the impression that the programs tried use the clipboardData["RTF"].
And having perfect results in TextMaker and WordPad shows that the Win clipboard mechanism actually supports even background colors.

Hope I could help, have fun!

*) Can't help to add a shameless ad for Softmaker Office - it's by far the fastest and most compatible/ reliable office suite. Available for Win, Linux & Android, price below €100 for the biggest version (I paid €20 for a 3-machine lifetime license in a special offer ...).
And it has a smaller free cousin, "FreeOffice" - again for Win, Linux and Android. It lacks mainly some dictionaries and some exotic file formats, compared to the bought version.
This is what I use when getting/ being forced to deliver MS Office or Open/ Libre Office formats, where my old RagTime is helpless.
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: copying and pasting from/to fields not working?

Post by FourthWorld » Thu Dec 08, 2016 4:41 pm

Excellent sleuthing, Ax. From our tests it's become clear that:

- LC appears to be putting all relevant styling data into both the public and private clipboard
- Windows (and perhaps macOS and Linux) support background color as part of the text clipboard structures
- Where the background color doesn't appear depends on the capabilities of the app the data is being pasted into

We haven't heard from the OP, Ed, in a while, but it would appear from what we've learned that if preserving the background color in the application being pasted into is critical it may require either redesign so that's less important, or requiring the user to paste into the subset of apps that support background color from the clipboard.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: copying and pasting from/to fields not working?

Post by dunbarx » Thu Dec 08, 2016 5:23 pm

Jacque.

When you were 14, did you set the itemDel to "L" and simply answer to item 1 of your long name?

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: copying and pasting from/to fields not working?

Post by jacque » Fri Dec 09, 2016 10:59 pm

"From our tests it's become clear that:

- LC appears to be putting all relevant styling data into both the public and private clipboard
- Windows (and perhaps macOS and Linux) support background color as part of the text clipboard structures
- Where the background color doesn't appear depends on the capabilities of the app the data is being pasted into
Like I said on the first page... :)
http://forums.livecode.com/viewtopic.ph ... 12#p149101
Last edited by jacque on Fri Dec 09, 2016 11:04 pm, edited 1 time in total.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: copying and pasting from/to fields not working?

Post by jacque » Fri Dec 09, 2016 11:03 pm

dunbarx wrote:When you were 14, did you set the itemDel to "L" and simply answer to item 1 of your long name?
When I was 14 I wasn't interested in programming because I thought it required math. Wait, that's wrong. When I was 14 we didn't have computers. My nephew asked me once if I learned computing when I was growing up. When I told him there weren't any he was positively stunned. It was outside his experience.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: copying and pasting from/to fields not working?

Post by FourthWorld » Sat Dec 10, 2016 5:56 pm

jacque wrote:
"From our tests it's become clear that:

- LC appears to be putting all relevant styling data into both the public and private clipboard
- Windows (and perhaps macOS and Linux) support background color as part of the text clipboard structures
- Where the background color doesn't appear depends on the capabilities of the app the data is being pasted into
Like I said on the first page... :)
http://forums.livecode.com/viewtopic.ph ... 12#p149101
Indeed you did. I got distracted by the discussion of htmlText and tagging, which as you also noted there won't affect what the receiving app can do with the public clipboard's binary structures.

I think I was also somewhat optimistic in assuming the OP had already considered app-specific limitations, and was working with one like Ax had found where supporting background color would be a reasonable expectation.

The ease of GUI programming in LiveCode is a dual-edge sword: it lets us cut through tasks so effortlessly that too often we forget how apps work with the host OSes under the hood. For all the talk of "LiveCode should do this!" and "LiveCode should do that!" quite often I find so many apps that don't do a fraction of what LC does so well we think it's all easy. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: copying and pasting from/to fields not working?

Post by jacque » Sat Dec 10, 2016 8:23 pm

I shouldn't have teased you. It's easy to forget how much work you do here as a volunteer and how much material you need to read every day. It's much appreciated.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

concorde
Posts: 1
Joined: Wed Feb 27, 2019 12:39 pm

Re: copying and pasting from/to fields not working?

Post by concorde » Wed Feb 27, 2019 12:53 pm

I am a bit late to the Livecode game.
I had the same problem, but only when I used menu builder and deleted the Edit menu.
This had the effect of stopping the copy, paste & cut working.
Solution:
Don't delete the Edit menu item.
Hit Auto script
Edit script
Fill in the switch/case statements with cut, copy & paste
Save the app and all should work OK.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”