show menu

Martin Blackman martinblackman at
Sun Feb 27 08:27:23 EST 2005

You could have something like the following in a card or stack script.

on preopencard
  set the traversalon of btn "Context" to false --prevents losing selection
end preopencard

on mouseDown theButton
  if (theButton is 3) and (word 1 of the target = "field") then
    -- prepare the menu if desired, eg:
    set the enabled of menuitem 2 of btn "Context" to the cAcceptPaste of 
the target
    popup button "Context"
  end if
end mouseDown

The button "Context" must be a popup menu button and be sure to set its 
menumousebutton property to 0 to prevent strange behaviour.  Put it 
somewhere on the card and set its visible to false. You need to script the 
context button with something like the following.

on menupick theitem
  switch theitem
  case "Copy"
  case "Paste"
  case "Cut"
  end switch
end menupick

Martin Blackman

>How can I show the menu items of a popup menu when right clicking in a 
>Like any text editor would have cut, copy, paste e.t.c
>I could always include a menu bar at the top of the field or window but I 
>think most people are used to right clicking in an editable field!
>  Thanx............

More information about the use-livecode mailing list