Keeping window of another application active while still receiving mouse events from another app's window?

Is there a way to have my app's window receive keyboard and/or mouse events (i.e. user clicking on window's buttons) while still retaining focus to another, unrelated app?

I've tried configuring my window at different levels, including [myWindow setLevel:NSPopUpMenuWindowLevel] to no avail.

Answers


You should be able to handle mouse clicks without ordering your window front by making your views (at least the ones that handle mouse clicks) respond to acceptsFirstMouse: messages by sending NSApp a preventWindowOrdering message and then returning YES.

You should not make your app handle typing without ordering itself front. The user might not realize where their typing is going if the field where it's appearing is obscured by another window.


Found it. Simple, yet elusive.

Use NSPanel and make sure panel style is Non Activating (NSNonactivatingPanelMask) or tick the same option in IB's inspector.


Need Your Help

How to make an IFRAME stretch all the vertical space inside a table cell?

html firefox iframe height stretch

I have a table cell whose width is fixed at 180 pixels and height is variable. I want to display an IFRAME inside it.

How to Enable Full-Text Index on Sql Server 2008 Table

sql-server sql-server-2008 full-text-search

Not sure what's happening with this, but here's my question. I have a Sql Server 2008 database that I need to be able to do full-text indexing/searching but when I try to setup my indices on the t...