|
|
Copy and Paste inside editable fields
Added on 10/2/2000
|
Compatibilities:
Required Xtras:
Buddy API
|
This item has not yet been rated
|
This behavior allows field members to use the Ctrl + C, Ctrl + V, and Ctrl + X commands for copy, paste, and cut. THis is not a variable, it actually writes to the windows clipboard so the data is available to other fields as well as other programs.
Note- this will only work with field members, not text members and it does not function correctly in authoring mode, only in projectors.
property spriteNum
on keyDown me
if the key = "c" and the commandDown then
copySelected()
dontpassevent
else if the key = "v" and the commandDown then
pasteSelected()
dontpassevent
else if the key = "x" and the commandDown then
cutSelected()
dontpassevent
else
pass
end if
end
on copySelected me
thetext = the Selection
baCopyText(thetext)
end
on cutSelected me
thetext = the Selection
baCopyText(thetext)
theStart = (the selStart+1)
theEnd = (the selEnd)
delete char theStart to theEnd of member the member of sprite spriteNum
end
on pasteSelected me
theText = baPasteText()
theStart = (the selStart+1)
hiliteNum = theText.char.count
if thestart < 1 then set theStart = 1
theEnd = (the selEnd)
oldText = (sprite spriteNum).member.text
if ilk(theText) = #string and (sprite spriteNum).member.type = #field then
put theText into oldText.char[(theStart)..(theEnd)]
(sprite spriteNum).member.text = oldText
hilite char theStart to (theStart + hiliteNum - 1) of member the member of sprite spriteNum
end if
end
on getBehaviorDescription me
describe = "This behavior allows field members to use the Ctrl + C, Ctrl + V, and Ctrl + X commands for copy, paste, and cut. THis is not a variable, it actually writes to the windows clipboard so the data is available to other fields as well as other programs." & return & "Note- this will only work with field members, not text members and it does not function correctly in authoring mode, only in projectors."
return describe
end
|
|