I am using this notification for NSComboBox. Only problem is when I select a different item in the dropdown it always show previously selected value in the combo box. How can I get the currently selected value. I need to make some controls enable/disable based on the value.
- (void)comboBoxSelectionDidChange:(NSNotification *)notification {
NSComboBox *comboBox = (NSComboBox *)[notification object];
NSLog(@"[comboBox stringValue] : %@", [salaryBy stringValue] );
}
I got the selected value using:
I have also noticed this bug and fixed it in a different way. The correct value can be fetched when we read the value in the next run of the main run loop after the comboBoxSelectionDidChange method call as shown below
produces the desired result
I use these code with success!
Setting up:
Hope this help.