Contextual Menus

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sat Jun 7 04:47:00 EDT 2008


Bonjour Bill,

Le 7 juin 08 à 09:58, Bill Vlahos a écrit :

> How do I implement a right-click on a field?
>
> For example:
> 	Select word(s) in the field
> 	Right-click on field to get a context menu of choices:
> 		Cut
> 		Copy
> 		Paste
> 		etc.
>
> Bill Vlahos

on mouseDown pButton
if pButton = 3 then
   <build the menu on the fly>
   <put it into a 'popup menu' button>
   popup btn <'popup menu' button>
end if
end mouseDown

And, of course, a menuPick handler in the script of <'popup menu'  
button>.
As, usually, contextual menus may be called from different objects  
with different contents (they are contextual, right?), it's easier to  
gather all code to show the menu or respond to the user choice in a  
single place using a switch structure relaying on the target, a  
custom prop you have set, etc.

As to build the menu contents on the fly, you might be interested in  
my tutorial #008 How to build and manage dynamic menus.
 From Tutorials PIcker or my website.

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list