Re: [NSCursor set] not setting the cursor
Re: [NSCursor set] not setting the cursor
- Subject: Re: [NSCursor set] not setting the cursor
- From: John Mikros <email@hidden>
- Date: Tue, 21 Sep 2004 14:34:30 -0700
Did you try explicitly bringing your app to the front when you're in
this mode, and then setting the cursor? Clearly, you can only interact
with your app at that point, so UI wise I think it's OK.
This is how you'd do it in Carbon, and it should probably work in a
Cocoa app.
However, I have no idea if there are any issues related to being a
NSUIElement...
ProcessSerialNumber psn = { 0, kCurrentProcess };
SetFrontProcess( & psn );
-john
On Sep 20, 2004, at 5:48 PM, Brent Marykuca wrote:
Hello,
We have a Cocoa application that is a "UI Element", i.e. it sets
LSUIElement=1 in it's property list and doesn't display a menu bar or
show up in the dock. Our application works with some hardware that has
a remote control device.
Part of the app's function is to allow the user to take a snapshot of
the screen and then annotate it. So you could be looking at your
desktop with a Safari window open with your web site on it, and then
press a button on the remote control to activate our app and start to
use a few simple tools to draw on the image of the screen. What is
happening, of course, is we grab the screen image, make ourselves the
front process and display the snapshot in a full screen window and let
the user draw on it. Simple enough.
Since the screen image doesn't change at all when you do this, to
indicate that we're now in a "drawing" mode, we want to change the
mouse cursor from the standard arrow to a "pen". To do this we call
[NSCursor set].
If we do this when our application is already the front process then
it works just fine.
However, if this function is triggered when some other application is
the front process (by far the more common scenario), the cursor stays
set to the arrow and no amount of calling [NSCursor set] will cause it
to change until you click the mouse. That means the user gets no
feedback that they're in this drawing mode.
I have tried everything that I can think of to work around this
problem, including:
-- disabling cursor rectangles on the snapshot window's view
-- used a runloop perform to set the cursor again
-- used a timer to set the cursor again after the application was
frontmost
-- used applicationDidBecomeActive notification to set the cursor
-- used Carbon APIs instead of Cocoa ones
-- made sure that no calls to NSCursor set were being made before the
application was the active one
In all cases, the cursor wouldn't budge from the standard arrow.
My suspicion is that the Window Server is responsible for this, but
I'm not sure where to look to gain an understanding of this behavior
and some ideas for working around it.
Can anyone give me some clues?
Regards,
Brent Marykuca
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden