Page 1 of 1

Edit Menu - a default one - otherwise you get nothing

Posted: Tue Feb 14, 2023 1:31 am
by aetaylorBUSBnWt
Hello,

While the following might be obvious, it took far longer than it should have to discover because the following information does not exist in a complete simple fashion anywhere. The dictionary entries do not have this information and the one for Paste is bizarre.

Now it will for future beginners.
This does the simplest possible, but probably sufficient for most cases.
(NO "Suspend development Tools" is not helpful - it does nothing to implement cut, copy, paste)
The following code works no matter what state "suspend development tools" menu pick is in

It started from the "autoscript" code - which should really have this as a default.

Code: Select all

--The following menuPick handler was generated by the Menu Builder.
on menuPick pWhich
   switch pWhich
      case "Cut"
         set the clipboarddata[text] to the selectedtext
         put empty into the selection
         break
      case "Copy"
         set the clipboarddata[text] to the selectedtext
         break
      case "Paste"
         if the clipboard is text then paste
         break
      case "Clear"
         put empty into the selection
         break
      case "Preferences"
         --Insert script for Preferences menu item here
         break
   end switch
end menuPick

Re: Edit Menu - a default one - otherwise you get nothing

Posted: Tue Feb 14, 2023 11:51 am
by stam
I know there is a detailed section on menus/menu builder in the 'User Guide' -- the PDF that is accessible through the 'Help' menu. This, and more useful stuff, is probably all in there (although I haven't checked this specifically, but it's been pointed out to me previously for related issues).
It's one of the great underutilised resources and a lot of effort has gone into creating it -- I just never understood why it isn't html format on LC's site so it's easily searchable over the web...