show menu

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


Dwayne
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"
    copy
    break
  case "Paste"
    paste
    break
  case "Cut"
    cut
    break
  end switch
end menupick

regds
Martin Blackman

>
>How can I show the menu items of a popup menu when right clicking in a 
>field?
>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