outsmarted myself with menus?

J. Landman Gay jacque at hyperactivesw.com
Tue Mar 24 22:26:25 EDT 2015


On 3/24/2015 6:29 PM, Dr. Hawkins wrote:
> I've created menus and handlers, and use behaviors for them.
>
> But when I want to paste, the handler can't find where I was.
>
> If I'm in a field, "me" and "the target" both point to the menu button, not
> the field; the selectedObject contains nothing, and I can't find something
> like "menuSource".
>
> THis is obviously easy and long solved; what am I missing?

I've never used behaviors in menus. The Edit menu is the easiest to 
script, the engine keeps track of everything for you. You only need a 
single word for each switch item to cover the basic stuff. Here's my 
standard Edit menu:

on menuPick which
   switch which
   case "Cut"
     cut
     break
   case "Copy"
     copy
     break
   case "Paste"
     paste
     break
   case "Undo"
     undo
     break
   case "select all"
     if the selectedfield <> "" then select text of the selectedfield
     break
   end switch
end menuPick

This works with anything: text, images, objects, etc.


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




More information about the use-livecode mailing list