How to copy-paste text from one field to another, changing Font and Size

Klaus Major klaus at major-k.de
Fri Aug 24 08:23:10 EDT 2007


Bon jour André,

> I have a stack 1, including a field (field1) with lines of text.
> The textFont of this field is « verdana »
> The textSize of this field is « 10 »
>
> and a stack 2 including an empty field (field2)
> The textFont of this field is « Times »
> The textSize of this field is « 12 »
>
> I want to copy such line of field 1 in order to paste it in field 2
>
> If I proceed manually (using the Edit menu or ctrl C and ctrl V)  
> all is running as expected :
> the copied line of field 1 (in Verdana 10) is paste in Times 12 in  
> field 2.
>
> But  when scripting, if, in stack 1, I
> -       put such line of field 1 in lVar
> -       set the clipBoardData[« text »] to lVar
> -       go to stack 2
> -        click a button whose mouseUp’ script is « paste »
>
> then, the text is pasted in Verdana (it keeps the font of field  
> 1) :-((
> and more surprising, the textSize is 12 (the textSize expected,  
> those of field 2).
>
> What am I doing wrong ?
>
> By the way, is it possible to change Font, size, style etc. of text  
> in the clipBoard ?
>
> Thanks a lot for any help
>
> Best regards from Grenoble
> André

just change these line:
...
put the htmltext of line X of field 1 in lVar
set the clipBoardData["html"] to lVar
## Otherwise only unformatted text will go into the clipboard
##  as you already may have noticed :-)
...


Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de





More information about the use-livecode mailing list