Right clicking in Text Entry Field and show Popup Menu

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am

Right clicking in Text Entry Field and show Popup Menu

Post by keithglong »

Hi All,

I am new to LiveCode and have a question. If I place a Text Entry Field onto a Stack, and then create a Popup Menu (i.e., as a Button Menu), how can I set it so that whenever the user right clicks in the Text Entry Field (i.e., such as after highlighting text), the applicable Popup Menu displays?

I have been playing with things but cannot seem to figure it out. (And my Popup Menus keep freezing when using the right mouse button. Strange.)

Are there any good examples out there? (I could not find any--but again, new here.) ;-)

Thanks!

Keith
keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am

Re: Right clicking in Text Entry Field and show Popup Menu

Post by keithglong »

Hi Again,

Okay, I think I figured it out. I used the following code in the script for my Text Entry Field:

Code: Select all

on mouseUp theButton -- show popup menu on right-click
   
   if theButton is 3 then

      if there is a button PopUp then popup button Popup

   end if
  
end mouseUp
The problem is, if I highlight text in the Text Entry Field, and then right click, the text gets deselected when the Popup Menu shows. Is there any way to prevent the text from being deselected? (Or perhaps I should just add the selected text to the clipboard--or to a variable--BEFORE displaying the Popup Menu?)

Not sure.

Thanks,

Keith
shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Right clicking in Text Entry Field and show Popup Menu

Post by shaosean »

Set the traversalOn property of the popup menu to false.
keithglong
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 348
Joined: Sun Jul 03, 2011 2:04 am

Re: Right clicking in Text Entry Field and show Popup Menu

Post by keithglong »

That did the trick; thanks shaosean! (And I am sure I will have many more questions down the line.)

LiveCode ROCKS! I love it.

Cheers from Florida,

Keith
Post Reply