pop-up menu on mouse right button click

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lbtony
Posts: 35
Joined: Tue Apr 11, 2006 9:01 am

pop-up menu on mouse right button click

Post by lbtony » Thu Apr 27, 2006 3:27 pm

I'm thinking to use a pulldown button and hide it so I put something in my stack script or card script like:

on mouseUp
set the visibility of the pulldown button to true
......
end mouseUp

but my question is, how can I bring the pulldown menu to the proper position(not the mouse loc)?

is there any better way of doing it??
Thank you...

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: pop-up menu on mouse right button click

Post by Janschenkel » Thu Apr 27, 2006 5:11 pm

A better option is to put your opup menu button somewhere off-screen, and then use a script like:

Code: Select all

on mouseUp pMouseButton
  if pMouseButton = 3 then 
    popup button "MyPopupButton" at the clickLoc
  else
    -- do other stuff here
  end if
end mouseUp
The popup menu button will receive the 'menuPick' message when the user picks one of the items, so you'll have to move some of your logic into that menu button as well:

Code: Select all

on menuPick pItem
  switch pItem
    case "Hello world"
      answer "Hello, world!"
      break
    case "Foo"
      answer "Bar" with "Cancel"
      break
    -- more case statements here
  end switch
end menuPick
Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply