Question

I encountered a very strange problem which I can't solve by myself. I have several UI elements embedded in a NSWindow running as NSBorderlessWindowMask. There are 2 NSSlider, 3 NSButton, a NSComboBox and a NSColorWell.

The application builds for target 10.7 and has sandboxing enabled.

On my development machine every element works as intended. The NSComboBox has a working DataSource and Delegate. The NSColorWell does work too. When I click into the NSComboBox, I can type a text into it. And the NSColorWell opens a color selection.

The moment I hand my app to my beta-tester, the NSComboBox and the NSColorWell can't be edited. This means, that I can add elements to the DataSource of the NSComboBox (via an import) and they may be selected in the dropdown menu, but I can't click into the NSComboBoxCell and write a text. Also no color selection opens when I click the NSColorWell.

I have no clue at all what could cause this behavior. Every element is hooked up correctly and I run the same binary as my beta-tester. The systems both run Mountain Lion in its latest version. I tried creating a NSButton for the beta-tester which runs following methods on the NSComboBox:

[self.nameCB reloadData];
[self.nameCB setEnabled:YES];
[self.nameCB setEditable:YES];
[self.nameCB setNeedsDisplay:YES];
[self.nameCB setFrame:self.nameCB.frame];
[self.nameCB becomeFirstResponder];
[self.nameCB setSelectable:YES];

None helped. I have no clue how to "debug" this behavior. Do you have any suggestions?


Edit: I was able to break it down a bit. When I remove the line

[self.window setStyleMask:NSBorderlessWindowMask];

It works. But I want to get a nice look from removing the titlebar, so it only helps a bit.

Was it helpful?

Solution

As I already edited into my question I found out that this problem is caused by the NSBorderlessWindowMask style on my main NSWindow. I found no other way around it than subclassing NSWindow.

I used this example as a guide. It also works if you just extract the CustomWindow class from the project and add it to your project. Then just set the class of your window in IB to the CustomWindow

I still don't know what caused this problem. If anybody has an idea feel free to leave another answer below please.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top