Xojo Conferences
XDCMay2019MiamiUSA

[MBS] Global HotKey Only in Finder? (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] Dock Menu Example?
Next thread: [MBS] Console printing


Re: [MBS] MIDI Destinations and External Devices   -   Ron Benditt
  [MBS] Global HotKey Only in Finder?   -   Lists
   Re: [MBS] Global HotKey Only in Finder?   -   Christian Miller
    Re: [MBS] Global HotKey Only in Finder?   -   Lists
     Re: [MBS] Global HotKey Only in Finder?   -   Christian Miller
      Re: [MBS] Global HotKey Only in Finder?   -   Lists
       Re: [MBS] Global HotKey Only in Finder?   -   Christian Miller
       Re: [MBS] Global HotKey Only in Finder?   -   Christian Schmitz

[MBS] Global HotKey Only in Finder?
Date: 27.04.03 02:21 (Sat, 26 Apr 2003 20:21:25 -0500)
From: Lists
RESEND - My first attempt was sent from the wrong e-mail...
---
I'm hoping someone can help we out with a slight problem here...

I'd like to use the CarbonApplicationEventMBS and CarbonHotKeyMBS classes to
set up a global hotkey that my application then responds to.

However, I want this hotkey to only be available in the Finder. As it is,
when this hotkey is set up, it interferes with any built-in command-key that
the currently active application has that uses the same combo.

My application only needs this hotkey to work in the Finder and the Finder
does not have an equivalent command-key combo.

Any ideas?

Sincerely,

Scott

Re: [MBS] Global HotKey Only in Finder?
Date: 27.04.03 02:38 (Sat, 26 Apr 2003 21:38:30 -0400)
From: Christian Miller

On Saturday, April 26, 2003, at 09:21 PM, Scott Crick (Lists) wrote:

> My application only needs this hotkey to work in the Finder and the
> Finder
> does not have an equivalent command-key combo.
>
> Any ideas?

When the hot key is hit and your app event gets fired, check to see
which running process is in the front. If it's not the Finder, then
don't do anything.

Re: [MBS] Global HotKey Only in Finder?
Date: 27.04.03 02:47 (Sat, 26 Apr 2003 20:47:25 -0500)
From: Lists
On 4/26/03 8:38 PM, "Christian Miller" <realbasic@nc.rr.com> wrote:

>
> On Saturday, April 26, 2003, at 09:21 PM, Scott Crick (Lists) wrote:
>
>> My application only needs this hotkey to work in the Finder and the Finder
>> does not have an equivalent command-key combo.
>>
>> Any ideas?
>
> When the hot key is hit and your app event gets fired, check to see
> which running process is in the front. If it's not the Finder, then
> don't do anything.

That's what I'm doing now. The problem is, even if the Finder isn't the
front application, my application is still capturing the hot key and it is
never passed to the front application. So, if that application uses the same
key-combo for a command as my hotkey, that application won't respond to the
keypresses because my application has intercepted them.

Sincerely,

Scott

Re: [MBS] Global HotKey Only in Finder?
Date: 27.04.03 02:59 (Sat, 26 Apr 2003 21:59:39 -0400)
From: Christian Miller

On Saturday, April 26, 2003, at 09:47 PM, Scott Crick (Lists) wrote:

> That's what I'm doing now. The problem is, even if the Finder isn't the
> front application, my application is still capturing the hot key and
> it is
> never passed to the front application. So, if that application uses
> the same
> key-combo for a command as my hotkey, that application won't respond
> to the
> keypresses because my application has intercepted them.

Oh! I'm hoping that I'm not helping my competition here. ;) I don't
use the hot-key idea in my code. I simply poll the keyboard. If the
key is pressed, then I react. This way, the front-most app still
receives the event it needs, and I know what the user hit.

Re: [MBS] Global HotKey Only in Finder?
Date: 27.04.03 03:29 (Sat, 26 Apr 2003 21:29:47 -0500)
From: Lists
On 4/26/03 8:59 PM, "Christian Miller" <realbasic@nc.rr.com> wrote:

> Oh! I'm hoping that I'm not helping my competition here. ;) I don't
> use the hot-key idea in my code. I simply poll the keyboard. If the
> key is pressed, then I react. This way, the front-most app still
> receives the event it needs, and I know what the user hit.

Right. I do that in the current version of my app right now (I poll the
keyboard object in a timer). But the problem with this is, it's possible to
lose keypresses, requiring the user to press the "hotkey" more than once to
get the desired functionality.

The hotkey functionality in the MBS plugin provides a way to register a
global hotkey with the system so the system passes the hotkey directly to
the app, thus making sure no keypresses are lost. But, it is truly global,
and overrides command-keys in other apps... That's what I'm trying to avoid.

If it isn't possible, then I'll just stay with my current method. But I
really hope what I'm trying to do IS possible.

Sincerely,

Scott

Re: [MBS] Global HotKey Only in Finder?
Date: 27.04.03 03:49 (Sat, 26 Apr 2003 22:49:12 -0400)
From: Christian Miller

On Saturday, April 26, 2003, at 10:29 PM, Scott Crick (Lists) wrote:

> On 4/26/03 8:59 PM, "Christian Miller" <realbasic@nc.rr.com> wrote:
>
>> Oh! I'm hoping that I'm not helping my competition here. ;) I don't
>> use the hot-key idea in my code. I simply poll the keyboard. If the
>> key is pressed, then I react. This way, the front-most app still
>> receives the event it needs, and I know what the user hit.
>
> Right. I do that in the current version of my app right now (I poll the
> keyboard object in a timer). But the problem with this is, it's
> possible to
> lose keypresses, requiring the user to press the "hotkey" more than
> once to
> get the desired functionality.

True. I have my timer set to 50 which does a pretty good job of not
missing anything and not hogging the CPU. :)

Re: [MBS] Global HotKey Only in Finder?
Date: 27.04.03 11:17 (Sun, 27 Apr 2003 12:17:52 +0200)
From: Christian Schmitz
> On 4/26/03 8:59 PM, "Christian Miller" <realbasic@nc.rr.com> wrote:
>
> The hotkey functionality in the MBS plugin provides a way to register a
> global hotkey with the system so the system passes the hotkey directly to
> the app, thus making sure no keypresses are lost. But, it is truly global,
> and overrides command-keys in other apps... That's what I'm trying to avoid.

Make the key combination user definable...

And why don't you simply watch regulary (maybe ones a second) which
application is frontmost.
Than you can register the hotkey only if the Finder is in the front.

Mfg
Christian