RE: first attempt at delegation failing
RE: first attempt at delegation failing
- Subject: RE: first attempt at delegation failing
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Wed, 29 May 2002 15:03:50 -0400
Maybe I'm missing something here, but comboBox:completedString: isn't a
method implemented by the comboBox _delegate_. Rather, it may be
implemented by the _datasource_. If there is no datasource or no
implementation, "this method goes through the combo box's items one-by-one
and returns the first item which starts with the string that the user
entered," according to the "ComboBoxes" programming topic.
http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/Programmin
gTopics/ComboBox/index.html#//apple_ref/doc/uid/10000020i
Your printf is never going to be called, but it seems like completion should
still work (provided [myComboBox completes] == YES).
Jonathan
p.s. Not that it matters, but why not NSLog(@"completedString %@",
inputString)?
>
-----Original Message-----
>
From: email@hidden
>
[mailto:email@hidden]On Behalf Of Paul Cezanne
>
Sent: Wednesday, May 29, 2002 2:25 PM
>
To: email@hidden
>
Subject: first attempt at delegation failing
>
>
>
In one of my controllers I have this code:
>
>
- (NSString *)comboBox:(NSComboBox *)aComboBox
>
completedString:(NSString *)inputString {
>
printf("completedString %s\n", [inputString cString]);
>
}
>
>
and in .h file I have this:
>
>
- (NSString *)comboBox:(NSComboBox *)aComboBox
>
completedString:(NSString *)inputString;
>
>
and then I dragged the .h file to the .nib file and then in the
>
nib I have control dragged from my combobox to the "File's Owner"
>
and clicked the delegate label, then clicked the connect button.
>
>
My ComboBox does NOT have an external data source.
>
>
When I start typing in the combobox (and watch it auto complete),
>
my printf does not trigger. Clearly I have done my delegation
>
incorrectly.
>
>
(I also realize that this is the wrong method to delegate since I
>
want to be notified whenever any typing occurs anywhere, I'll
>
have to grab one of NSTextField's delagators for that, but I'm
>
sure I can figure that out once I get a simple delagator working.)
>
>
Thanks in advance.
>
>
Paul
>
_______________________________________________
>
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.
_______________________________________________
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.