AStudio Tip - 12/18/02 - Floating panel windows in 10.2

First, let me preface by giving proper credit where it’s due here. This solution was originally distributed via the AppleScript Studio discussion list by Tim Bumgarner of Apple’s engineering team. Thanks, Tim!

In OS 10.2 developer tools, there’s a bug with globally floating “Utility” panel windows which stay on top regardless of the frontmost application. Basically this means it’s not possible via IB’s inspector, like it was possible in previous versions of Interface Builder.

However, there’s a very easy workaround. Add the following to the “awake from nib” handler for the panel window you wish to float about all applications.

[Broken link]

Of course, be sure to wire it up to your script via checkboxes in IB’s inspector. (You can’t just paste it into your script. You’ll of course need to assign the handler to the window object.)

[Broken link]

The above line of code achieves programmatically what you can’t do in the IB GUI. (And that’s UN-check the “Hides on deactivate” checkbox in IB’s inspector. That’s the 10.2 IB bug.)

I hope you found this tip useful!

Apart from this, could you briefly explain how-to make a panel which floats over all applications? I’ve been taking a look to this tip, but I can check-uncheck allways “Hide on deactivate” checkbox…
Perhaps my version of IB works rigth or it is different than you’re talking to? (mine is IB 2.3)

lurking… :smiley:

The tip above ends up with a floating palette above all applications.
However, I’ve recently discovered that in order for it to be global, it seems necessary to drag in a completely NEW panel window from IB’s Aqua objects palette.

All this information comes from Jaguar/10.2 devtools.
I can’t speak for earlier versions.

it always worked fine for me! ha…

thanks for the tips TJ, hopefully there will be more :o

Of course, be sure to wire it up to your script via checkboxes in IB’s inspector. (You can’t just paste it into your script. You’ll of course need to assign the handler to the window object.)

This is something I’ve wondered about with various handlers. Does that mean you can’t just paste the handlers into your script if you have it attached to the script in the IB inspector!?

Thanks, jim

Yes, correct. You cannot just paste them in. You need to use the handler checkboxes in the inspector panel to ‘insert’ them. There’s something that goes on behind the scenes which makes them valid that way.

The code is currently missing from this tip. Anyone care to replace it?

Also, has anything changed with 10.3? I’d love to be able to set/unset floating status dynamically. Is this possible?

Sorry about that, folks.

thanks for the replaced code.

it may be worth mentioning that i’ve discovered you can make both regular windows as well as panels float/unfloat by setting the ‘level’ property of a window.

0 = non-floating
3 = the lowest floating status.

see the applescript studio reference on windows for an entire list of the float codes.

I tried all the above and it still doesn’t work. Could somebody please post complete instructions how to make a floating window? What checkboxes should be checked in IB? What should NSUIElement be set to? I have searched the forum and have found troubleshooting tips like these for people who already know how to do it, but there are no instructions for the complete process. I tried both Mac OS X 10.2 and 10.3.4, and none of the above suggestions make the window float. Thank you.

Setting the property level works great. Thanks for the tip!

To Nobody. In your main script just input:
set the level of window “window1” to 1
set the level of window “window2” to 2 etc.
(where “window1” and “window2” are the names in the “AppleScript” section of the NSWindowInfo pane in IB.)

By the way, although this allows a window to float over all other windows, even if you set a text field on the highest level window to the first responder, other windows that are made active (other applications that are open, etc.) will receive the text. Is it possible to make a text field in your highest level window the target of text even if another window, or the finder, etc. is made active?

Thanks for your time and I look forward to hearing from someone soon.