7 Replies Latest reply on Jul 30, 2008 5:46 AM by Chunick

    Copy/Pasting Text into a Member

    ImLearningW3D
      I have a director movie(mx 2004) that I want to be able to Copy/Paste text from/into a text member. Since I have multiple Editable text members on the stage at one time, how do i determine which is the currently selected sprite? The "keyboardfocussprite" will not help b/c that is defaulted to -1. There IS the possibility of having multiple text sprites having their own member.selection setting. Is there a way to determine which is the "Active" sprite, so I know which to paste into?
        • 1. Re: Copy/Pasting Text into a Member
          Level 7
          > However, the paste function I want to do is, just like in any other app, paste
          > text into an existing block of text (could be empty text) but paste it where
          > the cursor is in the text member. Does anyone know how to paste text into the
          > cursor location of a text member?

          Have you tested this as a projector?
          Once you have _movie.editShortCutsEnabled = 1 (which defaults to TRUE if
          unaltered) you can copy a selection to the clipboard and paste the
          clipboard into the keyboardFocusSprite without having to do any
          hoop-jumping.
          • 2. Copy/Pasting Text into a Member
            ImLearningW3D Level 1
            Well, not really. Im still having issues with the writing of the handler itself. I planned on using the Buddy API's CopyText/PasteText functions to create the Copy and Paste functions in a typical "Edit" drop down menu item. But I have to know what sprite has the selected text so that I can send that to the BuddyAPI CopyText function.

            Same thing goes for Pasting text. I need to know which editable text member to paste into.

            Unless Im totally missing something here...which could be very possible :)
            • 3. Re: Copy/Pasting Text into a Member
              Level 7
              I'm suggesting to you that you don't need to write any code and attach
              it to anything. If your text members are editable, copy-and-paste should
              just work; so I'll again suggest you test this *as a projector*
              • 4. Re: Copy/Pasting Text into a Member
                ImLearningW3D Level 1
                Yes, Copy/Paste using Ctrl+C or Ctrl+V does work in the projector but the end-user also wants drop-down menu selections for those 2 functions.

                How do I have director perform a Ctrl+C or Ctrl+V from a menu item?
                • 5. Copy/Pasting Text into a Member
                  Chunick Level 3
                  you could do it a couple of ways:
                  1. baSendKeys("^C") for Copy and baSendKeys("^V") for Paste.
                  2. member(x).pasteClipBoardInto()... you can use keyboardFocusSprite, just test whether there's a text member with focus:
                  focusSpriteNum = _movie.keyboardFocusSprite
                  if focusSpriteNum <> -1 then
                  mem = sprite(focusSpriteNum ).member
                  mem.pasteClipBoardInto()
                  end if
                  3. Use Valentin's Clipboard Xtra: http://staff.dasdeck.de/valentin/xtras/clipboard/
                  4. Use a combination of all three options listed above.
                  • 6. Re: Copy/Pasting Text into a Member
                    ImLearningW3D Level 1
                    Well, IT WORKS!!!

                    HOORAY for Chunick!

                    I used a combination of #2 and #3 above. Works very well.
                    I tried the buddy api command but it liked dropping a "C" in for the baSendKeys("^C") command and a "V" in for the baSendKeys("^V") command.

                    Thanks again for all your help Chunick and Sean. It is much appreciated! :)
                    • 7. Re: Copy/Pasting Text into a Member
                      Chunick Level 3
                      the buddyAPI docs suggest not to use CAPS for the letters as it might be interpreted by some programs as CTRL+SHIFT+C instead of CTRL+C.... so you can always try "^c" as per the docs.