Scripting Cut/Copy/Paste in custom menus

Paul Hibbert paulhibbert at mac.com
Sun Sep 14 02:22:17 EDT 2014


Bob,

Cut, copy, paste & clear are available as commands in LC, so maybe simplifying your Edit menu a little may help, for example…

--The following menuPick handler was generated by the Menu Builder (& simplified a little).
on menuPick pWhich
   switch pWhich
      case "Preferences"
         --Insert script for Preferences menu item here
         break
      default
         do pWhich
   end switch
end menuPick

…It works for what you are describing as far as I can see, although it's not perfect.

Tested in LC 5.5.5 + 6.6.2 & 7.0(rc1) on Mac OS X 10.9.3

Cutting, or pasting within a field then tabbing out does trigger a closeField message, but "Copy" doesn't, possibly because the field didn't change even though the field still closed on tab, it does trigger an exitField.

However, "Clear" doesn't trigger a closeField message for some odd reason, but it does trigger an exitField, that seems a little inconsistent to me, because the contents of the field did change before exiting in much the same way that "cut" changes the field, I realise the "Cleared" text doesn't go onto the clipboard, but the effect on the field is the same.

So as far as I can see, "Clear" is the only case you would need to add a script for the lack of "closeField".

If anybody else sees the inconsistency with the "Clear" command as a bug, I would be happy to make a sample stack and report it, I'd just like to be sure I'm seeing it right before I do.

Paul


On Sep 13, 2014, at 5:55 PM, Bob Sneidar <bobsneidar at iotecdigital.com> wrote:

> First, if I cut or paste something in a field then tab out, closeField is not triggered.




More information about the use-livecode mailing list