Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Fetching global key events

Fetching global key events
Thread Tools
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
Feb 12, 2002, 08:15 AM
 
I'm currently writing a MenuExtra and I want to create shortcuts for some items. But it won't work using the "keyEquivalent:@"G"];" parameter. How can I do this ? One solution I found is that I could use the carbon GetKeys method in a timer (GetKeys returns just the keycode, so I would have to implement different keymappings by myself). But I think there's a much more elegant way to assign a shortcut to a global menu, or ?

Short: I would like to have access to the global event queue and check it for key events and maybe create some virtual events ...

Mahrz
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Feb 12, 2002, 09:08 AM
 
What about Carbon HotKeys (like what LaunchBar uses)?
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
mahrz  (op)
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
Feb 12, 2002, 09:50 AM
 
Originally posted by parallax:
<STRONG>What about Carbon HotKeys (like what LaunchBar uses)?</STRONG>
Well, sounds good, do you know a link to a documentation (I don't know Carbon HotKeys and I'm currently sitting at a pc in school, so I have no access to my docs and can't download source ) ?

But this is no answer to my other question, how to create "virtual" events so that the system thinks that the user pressed a shortcut to copy/eject cd, pressed some keys or something like that ? Can anybody help me .... ?

Mahrz

[ 02-12-2002: Message edited by: mahrz ]
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
mahrz  (op)
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
Feb 12, 2002, 09:55 AM
 
Originally posted by mahrz:
<STRONG>

Well, sounds good, do you know a link to a documentation (I don't know Carbon HotKeys and I'm currently sitting at a pc in school, so I have no access to my docs and can't download source ) ?
</STRONG>
Ok found it at apple dev doc .... Sorry for the stupid question ...

But I'm still searching a way to create globals events

Mahrz

[ 02-12-2002: Message edited by: mahrz ]

[ 02-12-2002: Message edited by: mahrz ]
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Feb 12, 2002, 10:50 AM
 
Originally posted by mahrz:
<STRONG>...
But it won't work using the "keyEquivalent:@"G"];" parameter.
...
</STRONG>
do you mean: "this doesn't work" or "this is not what i want in my app"?

if it was the former, you are aware of the fact that "G" equals command-SHIFT-g, right? if you just want command-g, use "keyEquivalent:@"g"];"
     
mahrz  (op)
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
Feb 12, 2002, 11:19 AM
 
Originally posted by seb2:
<STRONG>

do you mean: "this doesn't work" or "this is not what i want in my app"?

if it was the former, you are aware of the fact that "G" equals command-SHIFT-g, right? if you just want command-g, use "keyEquivalent:@"g"];"</STRONG>
It doesn't work ..., you can see the shortcut but nothing happens if you press the keys.

I'll test the carbon hotkeys they look like what i wanted ...
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
mahrz  (op)
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
Feb 12, 2002, 02:09 PM
 
Originally posted by parallax:
<STRONG>What about Carbon HotKeys (like what LaunchBar uses)?</STRONG>
I figured out how these HotKeys work. My MenuExtra registers a carbon event handler and the hotkey. But then I have to start the carbon event loop !

If i start the carbon event loop my MenuExtra recognizes the hotkey but i can't move any MenuExtra anymore !

[ 02-12-2002: Message edited by: mahrz ]
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Sep 3, 2003, 05:28 PM
 
Edit: nevermind.

Why did I bump this?! Pay attention, me!
(Last edited by Wevah; Sep 3, 2003 at 05:42 PM. )
[Wevah setPostCount:[Wevah postCount] + 1];
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:40 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2