2

I have a problem that is similar to this question. (Actually, I had the same problem and now I'm trying to get around it by not using placeholder strings)

I have 3 NSComboBoxes. Sometimes I type something in one ComboBox and when I switch the focus to the next ComboBox it stops showing the string value. The string is still there, but it's not showing:

Focused NSComboBox

Unfocused NSComboBox

The NSComboBox Content Values is bound to a NSArrayController:

Controller Key: arrangedObjects
Model Key Path: @distinctUnionOfObjects.project.name

Any ideas on how to solve this?

Community
  • 1
  • 1
kroger
  • 448
  • 3
  • 10
  • This NSArrayController the Project combo box is bound to... what is its content? – iluvcapra Feb 12 '13 at 23:11
  • It's bound to a Core Data entity (for completion). The completion is working as expected. – kroger Feb 13 '13 at 21:45
  • I had similar issue with NSTextField during entering exiting fullscreen. Do you have any execution of code when combobox loses focus? Also check your bindings (to work everything correctly I usually bind Content/Content objects and Content values simultaneously) – sergeyne Feb 18 '13 at 07:52
  • @sergeyne The way execution happens is: I edit the Task and Project fields and execute code. The TextFields are cleaned and everything is fine. The app lives in the menubar, so the main window is hidden. The problem happens if I click on the menubar to have access to the main window and repeat the process. Thanks, I'll check the bindings. – kroger Feb 19 '13 at 09:27
  • I did bind Content, in addition to Content Values but I'm still having the same problem. – kroger Feb 19 '13 at 09:36
  • @sergeyne How did you solve your problem? Just by adding the extra binding? – kroger Feb 19 '13 at 09:43

1 Answers1

0

Try to implement delegate method of main window and resign first responder from combobox

- (void)windowWillMiniaturize:(NSNotification *)notification
{
    NSWindow *window = [notification object];
    [window makeFirstResponder:window];
}

For some reason resign of first responder helped me

sergeyne
  • 1,268
  • 12
  • 18