Tool change shortcut

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: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
hoanghuynh
Posts: 1
Joined: Fri Jan 12, 2018 11:29 am

Tool change shortcut

Post by hoanghuynh » Mon Jan 15, 2018 3:12 am

After all these years, I just thought of using the right button on my mouse to switch between browse and pointer tools.
CODE: SELECT ALL

on rawKeyUp tKey
if tKey = 65473 then if the tool = "browse tool" then choose "pointer tool" else choose "browse tool"
end rawKeyUp
Put it into a plug-in. What a dope.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool change shortcut

Post by richmond62 » Mon Jan 15, 2018 8:38 am

Um . . . that could cause problems.

How about modifying it a bit:
on rawKeyUp tKey
if tKey = 65473 then
if the tool = "browse tool" then
choose "pointer tool"
else choose "browse tool"
end if
else pass rawKeyUp
end if
end rawKeyUp
I believe that without pass rawKeyUp
you won't get any reactions from any other keys.

It is not a bad idea to layout your code the way I have done
to make it easier for people to work out what is meant to be
going on.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool change shortcut

Post by richmond62 » Mon Jan 15, 2018 10:48 am

On my iMac (10.7.5) when I click on
a stack containing this code with my
right mouse button:

Code: Select all

on rawKeyUp RUP
   put RUP
end rawKeyUp
I get NOTHING.

with this:

Code: Select all

on rawKeyUp RUP
   set the backGroundColor to red
end rawKeyUp
Nothing happens either.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool change shortcut

Post by richmond62 » Mon Jan 15, 2018 10:53 am

HOWEVER:

Code: Select all

on mouseUp TRI
   if TRI = 3 then
      put "gottit"
      end if
end mouseUp
works perfectly.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3991
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Tool change shortcut

Post by bn » Mon Jan 15, 2018 4:47 pm

Hi hoanghuynh,

welcome to the forum.

there are a couple of issues with your approach.

rawkey 65473 is F-Key 4, so a mouse operation would never trigger this. Almost all rawkey-related messages are keyboard triggered, the scroll wheel also sends rawKey messages.
A mouse operation would send a couple of mouse-related messages. mouseDown, mouseUp, mouseStilldown, mouseDoubleUp etc with one parameter that indicates right, left or middle (1,2,3)

You want to put this into a plugin. Please consider the message path when you plan your stack.
Would the plugin ever receive a mouse or rawKey message? There are a couple of messages that your plugin can subscribe to, see Development Menu -> Plugins -> Plugin Settings. Your plugin would be informed by the IDE about those.

The only way I see to get a IDE wide rawKey message, or a mouseUp message would be a front script. I do not recommend going that way without a thorough understanding what a front or backscript does and how it can easily introduce a lot of "unexpected results".

Your could use command-alt-tab to switch between browse and edit mode (that is what I do) or find a suitable way to hack your IDE.

Kind regards
Bernd

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Tool change shortcut

Post by jacque » Mon Jan 15, 2018 9:01 pm

Another issue is interference with the IDE's contextual menus. A keyboard combination is safer.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”