Contextual Menus

Bill Vlahos bvlahos at mac.com
Sun Jul 20 21:06:46 EDT 2008


Thanks Eric.

I've added the following script to a field:
on mouseDown pButton
   if pButton = 3 then
     put "Cut" & return & "Copy" & return & "Paste" into tMenu
     put tMenu into button "b1"
     popup btn "b1"
   end if
end mouseDown

This didn't do anything until I also added a button (which can be  
hidden) called "b1". The button has a menuPick handler which correctly  
responds to the menu item selected.

However the text that had been selected in the field is deselected  
when the popup menu pops up so the menuPick item doesn't have anything  
to work with. An example would be to copy the text so I need the  
originally selected text to work with.

What am I missing?

Bill Vlahos

On Jun 7, 2008, at 1:47 AM, Eric Chatonet wrote:

> 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/
> ----------------------------------------------------------------
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list