Tool change shortcut
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 1
- Joined: Fri Jan 12, 2018 11:29 am
Tool change shortcut
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.
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.
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Tool change shortcut
Um . . . that could cause problems.
How about modifying it a bit:
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.
How about modifying it a bit:
I believe that without pass rawKeyUpon 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
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.
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Tool change shortcut
On my iMac (10.7.5) when I click on
a stack containing this code with my
right mouse button:
I get NOTHING.
with this:
Nothing happens either.
a stack containing this code with my
right mouse button:
Code: Select all
on rawKeyUp RUP
put RUP
end rawKeyUp
with this:
Code: Select all
on rawKeyUp RUP
set the backGroundColor to red
end rawKeyUp
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Tool change shortcut
HOWEVER:
works perfectly.
Code: Select all
on mouseUp TRI
if TRI = 3 then
put "gottit"
end if
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 3991
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Tool change shortcut
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
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
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Tool change shortcut
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
HyperActive Software | http://www.hyperactivesw.com