Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Milliseconds
robotduck.com
IMidi Xtra
Add Your file to windows Startup
DogEar xtra
StartFramesScript
IMS CharacterGenerator Studio
Scroll Thumb Track
macromedia.director.lingo
Trigonometry Class v0.6
MediaMacros Xtras Mall
 

 

 

Behavior Cut, Copy, Paste behavior 1.1

Added on 6/10/1999

 

Compatibilities:
behavior D6_5 Mac PC

This item has not yet been rated

Author: RettCrocker

Copy and Paste Text

property pMember

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

on getBehaviorDescription
  set lText = ""
  put "--======= Cut, Copy, Paste behavior =======--" & RETURN after lText
  put "This behavior, when added to an editable field " after lText
  put "sprite, gives this field the standard edit " after lText
  put "functionality one would expect from a text " after lText
  put "field.  In other words, selecting some text " after lText
  put "in the field and hitting CMD-C (or CTRL-C on " after lText
  put "Windows) copies the selected text to the " after lText
  put "clipboard.  Likewise, pasting and cutting also " after lText
  put "act as expected.  Give it a try.  You"ll " after lText
  put "like it." & RETURN & RETURN after lText
  put "As always, if you use this behavior I would " after lText
  put "like a mention in your credits.  Enjoy." & RETURN & RETURN after lText
  put "/// © Rett Crocker 1997 \" & RETURN after lText
  put "\ r3tt@mindspring.com ///" & RETURN after lText
  return lText
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail