Copying text in a field including the font style

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
jasper500
Posts: 5
Joined: Sun Oct 13, 2013 2:51 pm

Copying text in a field including the font style

Post by jasper500 » Sun Oct 13, 2013 3:04 pm

I am writing a character map program for mac and am having problems copying the rtf text in a field. I am using this code to copy the field contents:
set the clipboard data["rtf"] to the rtf text of field "CharsToCopy"
But when I paste it into word, the font is different. Any ideas why this isnt working?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Copying text in a field including the font style

Post by Simon » Sun Oct 13, 2013 5:17 pm

Hi jasper500,
You've split both the clipboardData and rtfText into 2 words...
set the clipboard data["rtf"] to the rtf text of field "CharsToCopy" --incorrect
set the clipboarddata["rtf"] to the rtftext of field "CharsToCopy" --correct

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jasper500
Posts: 5
Joined: Sun Oct 13, 2013 2:51 pm

Re: Copying text in a field including the font style

Post by jasper500 » Sun Oct 13, 2013 6:23 pm

Hi Simon, I'm afraid that was my typo, I did use rtftext and clipboarddata as single words but it still doesn't work. I've been at this for about a week and this is the only bit I need to fix. I just can't get the font type to copy.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Copying text in a field including the font style

Post by Simon » Sun Oct 13, 2013 6:34 pm

Hi jasper500,
I think you have to say which font and which characters as I just did a test here with Word and Batang font and it worked using the above code.
I am on a Win machine so that may be the difference (but shouldn't).

hmmm... maybe just having the font and characters is not enough. Better you build a small stack that displays the problem and post it here.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply