'un-style' clipboard text...

J. Landman Gay jacque at hyperactivesw.com
Tue Mar 2 12:12:11 EST 2004


On 3/2/04 10:23 AM, Richard Gaskin wrote:

> J. Landman Gay wrote:
> 
>> On 3/2/04 2:12 AM, Chipp Walters wrote:
>>
>>> Hi Jeanne, Jan -- me again :-)
>>>
>>> Turns out my RR2.1.2 was hosed. Reinstalled and now this works for me.
>>>
>>> on pasteIt
>>>   put the selectedChunk into tChunk
>>>   if tChunk is empty then exit to top
>>>   if the clipboard is text then
>>>     put the clipboardData["text"] into tTxt
>>>     put "put tTxt into " & tChunk into tDo
>>>     do tDo
>>>   end if
>>> end pasteIt
>>>
>>>
>>> This will effectively paste styled text w/out the style into a fld,
>>> replacing the selected text.
>>
>>
>>
>> This does too:
>>
>>   set the textstyle of the selection to "plain"
>>
>> It is both shorter and retains the selection and the scroll. No need 
>> to save and re-select.
> 
> 
> Since this is happening in a paste operation, wouldn't you need to first 
> get the offset to the beginning of the selection, count the length of 
> the clipboard contents, and set the selection accordingly before running 
> that line?
> 

Chipp said he was selecting text before pasting, and the paste was meant 
to replace the selection. So, he can do it all in one line.

I didn't address how he is capturing the paste operation -- but I think 
he's already got that part, since he had a handler called "pasteIt" that 
dealt with the text after it was already inserted.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list