Hi,
I have this panel and it’s my main window actually. It had to be a panel (windows would be so much easier) because it needs to be a HUD.
But the problem is that the panel constantly keeps floating above other windows I’d rather do it in AppleScript but Apple has some Objective-C stuff about it on http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPanel_Class/Reference/Reference.html. There are two things, “isFloatingPanel” & “setFloatingPanel:”.
So I tried this, I created an emtpy header file, called it NSPanel.h and first put - (NO)isFloatingPanel in it but it didn’t work, then I tried - (void)setFloatingPanel:(NO)floatingPanel In Apples references the “floatingPanel” was italic so I thought I needed to give it the name of the panel but again without results… Maybe I need to call it from AppleScript ? or are there other solutions ?
I want the panel to behave like a normal window, not hide on deactivation and not always on top…
Thanks in advance.
Hi put this in an .m file.
Just make sure to connect them in IB.
Thanks
And now, (probably as you expected) 2 questions,
- Can I just add that line in the main.m file without making a new .h and .m file?
- <the question you’ve feared of> What am I doing wrong ?
I created a new Objective-C class, named it PanelWindow (both the .m & .h file)
Added [mainPanel setLevel:NSNormalWindowLevel]; in the .m file like this
Then I created a new NSObject, named the class “Window”, created an outlet called “PanelWindow” and connected it to the panel…
→ 2 errors (and I guess when they’re fixed, I still did it wrong)
The first error is in the .m file “error: syntax error before ‘[’ token”
And I don’t see anything about a second error in the “Errors and Warnings” section although the icon of Xcode has a red button with a two in it… I do see “This view overlaps one of its siblings” in the section a few times but that was there before.
Any help would be greatly appreciated…
I can’t get it to work either…
I’m sure that what you’re telling me is 100% correct but I don’t have the knowhow
Oh my after searching over and over again on how to use objective-c, I found a plain AppleScript solution !
set the level of window "thePanel" to 0
Don’t know why but if I change “window” in “panel”, then it won’t work anymore… --well, actually doesn’t matter too much, it works now