Scripting Cut/Copy/Paste in custom menus

J. Landman Gay jacque at hyperactivesw.com
Mon Sep 15 00:15:01 EDT 2014


On 9/14/2014, 9:41 PM, Kay C Lan wrote:
> Now use the Menu Builder to create an OS X Menu for you, tick the box
> to Set as stack Menu Bar, have it auto build the script for you, and
> then open if for Edit and fill it as you would for Copy, Paste, and
> Clear. It should look something like this:
>
> --The following menuPick handler was generated by the Menu Builder.
> on menuPick pWhich
>     --breakpoint
>     switch pWhich
>        case "Cut"
>           --Insert script for Cut menu item here
>           break
>        case "Copy"
>           set the clipboardData["Text"] to the selectedText of the focusedObject
>           break
>        case "Paste"
>           put clipboardData["text"] into the focusedObject
>           break
>        case "Clear"
>           put empty into the focusedObject
>           break
>        case "Preferences"
>           --Insert script for Preferences menu item here
>           break
>     end switch
> end menuPick
>
> Do exactly the same as you did before. After you Paste and Tab or
> Clear and Tab LC will NOT Beep.

I think the magic message you're looking for is just to use the standard 
LC commands that are available. When I create a menu like this it works 
as expected:

--The following menuPick handler was generated by the Menu Builder.
on menuPick pWhich
   switch pWhich
     case "Cut"
       cut
       break
     case "Copy"
       copy
       break
     case "Paste"
       paste
       break
     case "Clear"
       clear
       break
     case "Preferences"
       --Insert script for Preferences menu item here
       break
   end switch
end menuPick


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list