Re: Finding out about new windows.
Re: Finding out about new windows.
- Subject: Re: Finding out about new windows.
- From: "Rob Napier" <email@hidden>
- Date: Tue, 1 Apr 2008 20:48:33 -0400
You can get what you're looking for by observing
NSWindowDidBecomeKeyNotification or several of the others. Look at the
Notifications section at the bottom of NSWindow's documentation. Should be
something like
[[NSNotificationCenter defaultCenter] addObserver:self selector:...
name:NSWindowDidBecomeKeyNotification object:nil];
object:nil means you want this notification no matter what window (of your
application) posts it.
I'm surprised you need to capture the display this way though if you're
going to put windows on top of it (rather than draw with Quartz). I'd be
interested in what was causing you trouble. My experience is that sticking
windows on top of a captured display is more hassle than it solves (hassles
like this one). But I can imagine things going the other way.
-Rob
On Tue, Apr 1, 2008 at 8:27 PM, Paul FitzGerald <email@hidden> wrote:
> Thanks Ricky, Kyle and Rob.
> I do appreciate your comments, but none of this addresses my question.
>
> I started working from TN2062 several months ago and only after a ton
> of research and experimentation found that this alone does not meet my
> needs (for reasons I won't get into here). I do, in fact, still have
> the kiosk stuff outlined in that technote implemented and have the
> GCaptureAllDisplays stuff on top of that.
> Anyway, that's water under the bridge.
>
> What I really want to know is how I can get notified when windows
> become active in my app.
>
> Paul
>
>
> On Apr 1, 2008, at 4:53 PM, Ricky Sharp wrote:
> >
> > On Apr 1, 2008, at 6:29 PM, Kyle Sluder wrote:
> >
> > On Apr 1, 2008, at 3:46 PM, Paul FitzGerald wrote:
> >>
> >>> I have a need to find a way for my application to find out when
> >>> new windows are opened within it.
> >>> The specific case I'm currently looking at is when the print
> >>> dialog is opened and the user chooses "Save as PDF...". This
> >>> action will open a file save dialog and I need to know when this
> >>> happens. I don't see any events that can notify me that this
> >>> window has opened.
> >>> Of course what I really want to know is when a window is supposed
> >>> to become visible.
> >>>
> >>> OK, I won't leave you wondering...
> >>> I'm working on a kiosk application and my main window is far above
> >>> the print dialogs so they don't display. If I can know when they
> >>> are to display I can grab them and pull them forward. Currently
> >>> when my main window delegate received a windowDidResignMain:
> >>> message I go look for "lost" windows and pul them forward. This
> >>> gets me the print dialog but since I am no longer active any
> >>> secondary dialogs get left behind my main window. Thus locking up
> >>> the machine (time to reboot).
> >>>
> >>> I'm using the method outlined in this link to make my application
> >>> very-front-most...
> >>>
> http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/AdvancedDrawing/chapter_9_section_4.html
> >>>
> >>> Paul FitzGerald
>
> >> I'm pretty sure this is no longer the recommended way to do a kiosk
> >> application. Instead, you can use SetSystemUIMode to hide the
> >> menubar
> >> and dock (or replace the Finder as the first app launched).
> >>
> >> TN2062 < http://developer.apple.com/technotes/tn2002/tn2062.html >
> >> has
> >> more information.
> >
> >
> > Definitely go this route (it's what I do). I also recently added
> > PDF generation features in my full-screen app and it works a-ok with
> > all AppKit dialogs.
> >
> > Capturing the screen is primarily used for games such that all UI
> > will be rendered/controlled without AppKit. In fact, you cannot
> > expect captured screens to work at all with AppKit. It may or may
> > not work depending upon the computer, graphics card, etc.
> >
> > ___________________________________________________________
> > Ricky A. Sharp mailto:email@hidden
> > Instant Interactive(tm) http://www.instantinteractive.com
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
Rob Napier -- Software and Security Consulting -- http://robnapier.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden