How to create utlity window that's not modal?


I would like to create a utility window (like the inspector windows of Xcode and IB) in my ASS project.

However, I cannot seem to figure out how to create a window that has a small title bar (like utility windows, or panels in ASS lingo) but otherwise behaves like an ordinary window (ie not modal and showing up in the Window menu of the menu bar).

It must be possible to do this because many applications have such windows. Is it not possible to do it with Studio?


What you want to do is far outside what apple wants in terms of it’s “Human Interface Guidelines”. So, they have not given much flexibility to developers to use the standard API’s to achieve this. To make a long story short, you’ll have to get creative.

That said, there is a pretty easy way to achieve the same thing but with a little more effort on your part. Use my posts on this page as a framework for getting started. Note my 3rd post, a detailed explanation of how to create a custom window class for your window. Essentially, you create a window with no border and no title bar… and then you create a title bar manually out of image view’s to get the custom title bar effect you’re looking for.

To get your title bar images, drag a utility panel to your project and take a snapshot of it (shift+cmd+3). To get fancy, test run the panel in IB and roll your mouse over the controls to get snapshots of both the active and inactive states. Then, in your favorite image editor, hack up the image into smaller images that can be placed into image views in your app. I usually do a background left, bg right, and a 1-pixel-wide bg center that can be set to automatically resize with the window. I also would get at least one image containing the close, minimize, and zoom buttons in their moused-over state… or 2 images, one for mouse-off and one for mouse-over. Then get busy in IB positioning images and using their settings in ‘size’ and ‘attributes’ to get them to work as you’d like. Make sure to note my comments in the other post about making image views ‘un-enabled’, or they will steal focus from the window and make it impossible to move your window to a new location by dragging the title bar.

The code in that post will make the window draggable by the entire window. To get the window to drag by the title bar you create only, get your system set up and then contact me and I can hand off some changes I’ve made to the custom class to get it to only drag by one certain region of the window… such as a title bar area. I’ve done this quite a few times, so contact me if you run into any obstacles and I’d gladly help.