Scripting Cut/Copy/Paste in custom menus

Paul Hibbert paulhibbert at mac.com
Mon Sep 15 00:52:48 EDT 2014


And you are correct Kay, in checking the target against the clipboard, after a busy day photographing dolphins I came back and tried another test.

My original suggestion was too simple in that if the clipboardData contained an image it would paste the image over the top of everything on the card even though the target was a text field.

My apologies for any confusion, I should have checked a few more options before posting instead of focussing too much on testing with text.

Paul


On Sep 14, 2014, at 9:19 PM, Kay C Lan <lan.kc.macmail at gmail.com> wrote:

> Except Paul is right, on OS X the clear command in a custom built menu
> does not invoke a closeField message which it does if using the IDE's
> clear command. This does seem to be a bug.
> 
> On Mon, Sep 15, 2014 at 12:15 PM, J. Landman Gay
> <jacque at hyperactivesw.com> wrote:
>> 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
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list