1 Reply Latest reply on Jul 30, 2006 7:56 PM by Lukewig

    How to initiate copy/paste from menu in projector?

    kmdguy
      I have a projector that uses a MenuMember to create a standard menu across the top i.e.:

      FILE EDIT HELP

      I have several text, (not field), but text members that are editable where the user inputs text information. Pretty basic and simple. If they use the keyboard commands for Copy, Paste, Select All & Cut those commands work fine in the text field and behave as you would normally expect.

      My question is, under my EDIT menu, I want to have the normal CUT,COPY,PASTE,SELECT ALL selections that you would expect to find. Right now I have no behaviors attached to them in my menuMember so they don't do anything if you go to EDIT -> PASTE.

      I have been looking for a handler to attach to the menuMember that would perform those functions. For example my menuMember text would look like this:

      menu: File
      Save/S | SaveHandler
      Quit | quit
      menu: Edit
      Copy/C | CopyHandler
      Paste/V | PasteHandler
      Select All/A | SelectAllHandler
      Cut/X | CutHandler

      So far I haven't been able to figure out any handler that would perform those functions upon the text field that has the focus. Oh sure, the manual keyboard equivalents WILL work, but most people also expect to see those choices in the edit menu as well and expect them to behave the same way.

      Any ideas on how to accomplish this?

      Thanks,
      Dan
        • 1. Re: How to initiate copy/paste from menu in projector?
          Lukewig Level 1
          Hi,

          There's a 'publish' settings (or maybe a movie setting) called "editShortcutsenabled' - if true, command-c (etc) will work. There might be some tricky way of evoking these functions with Lingo (not sure if DMX2004 has some new lingo), but you can do it manually using Valentin's free clipboard xtra ( http://staff.dasdeck.de/valentin/xtras/clipboard/) . For example, try these functions

          on SelectAll()
          whichSprite = the keyBoardFocusSprite
          if whichSprite > 0 then

          whichMember = sprite(whichSprite).member
          if voidP(whichMember) then exit

          mType = whichMember.type
          case (mType) of

          #field, #text:
          whichMember.selection = [0, whichMember.text.length]
          otherwise
          put "Dont know how to 'select all' in the case of a" && mType
          end case
          end if
          end


          on CopySelection ()

          whichSprite = the keyBoardFocusSprite
          if whichSprite > 0 then

          whichMember = sprite(whichSprite).member
          if voidP(whichMember) then exit

          mType = whichMember.type
          case (mType) of

          #field, #text:
          s = whichMember.selection
          txt = whichMember.text.char[s[1]..s[2]]
          clipSetData("TEXT", txt)
          otherwise
          put "Dont know how to copy from a" && mType
          end case
          end if

          end

          on CutSelection ()

          whichSprite = the keyBoardFocusSprite
          if whichSprite > 0 then

          whichMember = sprite(whichSprite).member
          if voidP(whichMember) then exit

          mType = whichMember.type
          case (mType) of

          #field, #text:
          s = whichMember.selection
          txt = whichMember.text.char[s[1]..s[2]]
          clipSetData("TEXT", txt)
          oldtext = whichMember.text
          if s[1] > 0 then
          newtext = oldtext.char[1..s[1]]
          newtext = newtext & oldtext.char[s[2]..oldtext.length]
          else
          if s[2] = 0 then
          newtext = oldtext
          else if s[2] = oldtext.length then
          newtext = ""
          else
          newtext = oldtext.char[s[2]..oldtext.length]
          end if
          end if
          whichMember.text = newtext
          otherwise
          put "Dont know how to copy from a" && mType
          end case
          end if

          end

          on PasteClipboard ()


          whichSprite = the keyBoardFocusSprite
          if whichSprite > 0 then

          whichMember = sprite(whichSprite).member
          if voidP(whichMember) then exit

          mType = whichMember.type
          case (mType) of

          #field, #text:
          txt = clipGetData("TEXT")
          InsertText(whichMember, txt)
          otherwise
          put "Dont know how to paste into a" && mType
          end case

          else
          put "what do I paste into?"
          end if
          end




          on InsertText (inMember, txt)
          s = inMember.selection
          oldtext = inMember.text
          if s[1] > 0 then
          newtext = oldtext.char[1..s[1]]
          newtext = newtext & txt
          newtext = newtext & oldtext.char[s[2]..oldtext.length]
          else
          if s[2] = 0 then
          newtext = txt & oldtext
          else if s[2] = oldtext.length then
          newtext = txt
          else
          newtext = txt & oldtext.char[s[2]..oldtext.length]
          end if
          end if
          inMember.text = newtext

          end