Re: Getting a Service-based app frontmost
Re: Getting a Service-based app frontmost
- Subject: Re: Getting a Service-based app frontmost
- From: Ken Tabb <email@hidden>
- Date: Fri, 21 Jan 2005 13:32:04 +0000
Please ignore the request below... sometimes I'm so stupid I amaze even
myself. Problem was when app was launched from Xcode, it worked lovely
as per code, but being stupid I'd forgotten to log out / in having
upped the project version number (and keeping old version's folder
hanging around)... the registered service was thus firing up a previous
version (which had none of the code below in). Doh!
Sorry to waste your good selves' time... I am an idiot, in case there
was ever any doubt.
The good news is the service is now working like a charm, and I
probably didn't need to spend a couple of hours delving into Carbon /
BSD's process manager last night just to achieve what I needed doing...
I just needed to log out/in 8^)
Note to self: when working on Service-based apps, log out, don't just
put powerbook to sleep...
Thanks anyway for those who replied and were as puzzled as me (this
doesn't mean you're as stupid as me, rest assured),
Ken
p.s. Yep there we go, all I needed to do was [NSApp
activateIgnoringOtherApps:YES]; ... curses!
p.p.s. It takes a man to admit his mistakes. And it takes a really
stupid man to keep having to do it time and time again...
On 20 Jan 2005, at 6:00 pm, Ken Tabb wrote:
Hi folks,
after extensive searching on Cocoa Builder I still can't fathom a way
to do this.
I have a Service based app which offers 1 service. In the method that
gets called, I need my app's one and only window to become frontmost,
and furthermore, for a specific NSControl to become key, so that after
pressing the Service shortcut (when in another app) you can continue
pressing keys in order to interact with the Service app's GUI.
I can get as far as making the app's window frontmost. That's easy,
there are loads of ways to do it, ranging from setting the window
level to an "always in front" level such as NSScreenSaverLevel /
NSStatusWindowLevel / NSFloatingWindowLevel etc. to telling the window
-makeKeyAndOrderFront etc.
However, nothing I try allows my control (an NSTableView) to become
first responder _when_ called from the Service. Lots of things work
fine from within the fired up app (that offers the service) but when
invoked as a service, stuff doesn't work.
For instance as a desperate measure I even tried [[NSWorkspace
sharedWorkspace] hideOtherApplications]... this works when run from
'within' the app, but when invoked from a service, it does nothing (it
gets called... but that's about it). It doesn't even hide the 'wrong'
apps (i.e. in case at time of execution it thinks the invoking app is
the frontmost)... weird.
If I invoke the service, then as I say I get the window frontmost. I
can then manually click on the tableView's background (empty rows) and
it's fine, I can then get key presses in the tableview. But it's a wee
bit inelegant from the point of the user...
Am I thinking about this wrong? Is there a better way to present a
responsive service GUI from a single (service menu) keypress?
Thanks in advance for any tips,
Ken
- - - - - - - - - -
Dr. Ken Tabb
Mac & UNIX Developer - Health & Human Sciences
Machine Vision & Neural Network researcher - School of Computer Science
University of Hertfordshire, UK
http://www.health.herts.ac.uk/ken/
Certified non-Microsoft Solution Provider
_______________________________________________
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
- - - - - - - - - -
Dr. Ken Tabb
Mac & UNIX Developer - Health & Human Sciences
Machine Vision & Neural Network researcher - School of Computer Science
University of Hertfordshire, UK
http://www.health.herts.ac.uk/ken/
Certified non-Microsoft Solution Provider
_______________________________________________
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