Re: NSComboBox problem
Re: NSComboBox problem
- Subject: Re: NSComboBox problem
- From: Bruno Gaufier <email@hidden>
- Date: Mon, 8 Sep 2003 21:28:53 +0200
Hi,
On Sunday, September 7, 2003, at 03:41 PM, Jeff Schneiderman wrote:
Thanks for the advice. I didn't try this particular solution.
Unfortunately, it also didn't work.
The problem is that I don't even get the textDidEndEditing
notification when the popup is open. Every action which would trigger
the EndEditing event is first caught and handled in order to close the
popup. So when the popup gets closed, it takes the selection and puts
it in the edit control and thus erasing everything I just typed.
Again, if I try removing the selection in the list, it clears the edit
control too. I'm in a catch-22.
Yes : Just tried all keys to re-check : You're right !!
- The <ENTER> (The big on on the main keyboard) : DOESN'T WORK
- The <ENTER> (The small one on the numeric keypad) : WORK ??
Trying something like :
- (void)controlTextDidChange:(NSNotification *)aNotification {
NSString * lValue = [[aNotification object] stringValue];
// _comboEntry is a member variable or anything like.
// Not sure this is needed (the retain/release stuff)
if (_comboEntry)
[_comboEntry release];
_comboEntry = [lValue retain];
}
- (void)comboBoxWillDismiss:(NSNotification *)notification {
// Force the last seen value (after the menu disappeared)
[__comboBox setStringValue:_comboEntry];
// Force call textDidEndEditing: (May be called by cocoa later. Not
needed ?)
[self textDidEndEditing:notification];
}
- (void)textDidEndEditing:(NSNotification*)pNotif {
// Should the be good value
NSString * lValue = [[pNotif object] stringValue];
// May be NSNotFound
int i = [self comboBox:__comboBox
indexOfItemWithStringValue:lValue];
// Do whataver is needed
// here
// Release
if (_comboEntry)
[_comboEntry release];
_comboEntry = nil;
}
It seems to work...
If it doesn't : No more ideas...
--
Bruno Gaufier
----
email@hidden
email@hidden
http://perso.club-internet.fr/bgaufier/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.