on beginSprite me
set lSprite = the spriteNum of me
set pMember = the memberNum of sprite lSprite
end
on keyDown
set lKey = the key
set lFlag = 0
if the machineType = 256 then
if the controlDown then
set lFlag = 1
end if
else
if the commandDown then
set lFlag = 1
end if
end if
if NOT lFlag then
PASS
return -1
end if
case lKey of
"c":
mCopySelection
"x":
mCopySelection
mDeleteSelection
"v":
mDeleteSelection
mPasteSelection
end case
end
on mCopySelection me
set lStart = the selStart
set lEnd = the selEnd
if lStart <> lEnd then
set lTempMember = findEmpty(member 1)
duplicate member pMember, lTempMember
delete char (lEnd + 1) to (length(field lTempMember)) of field lTempMember
delete char 1 to lStart of field lTempMember
copyToClipboard member lTempMember
erase member lTempMember
end if
end
on mDeleteSelection me
set lStart = the selStart
set lEnd = the selEnd
if lStart <> lEnd then
delete char (lStart + 1) to lEnd of field pMember
set the selStart to lStart
set the selEnd to lStart
end if
end
on mPasteSelection me
set lStart = the selStart
set lTempMember = findEmpty(member 1)
pasteClipBoardInto member lTempMember
set lText = chars(field pMember, 1, lStart) & field lTempMember & chars(field pMember, (lStart + 1), length(field pMember))
put lText into field pMember
erase member lTempMember
end