comboBox crash
comboBox crash
- Subject: comboBox crash
- From: Carrie Brezine <email@hidden>
- Date: Thu, 16 Jan 2003 18:01:03 -0500
I found this old question in the archives, but didn't find an answer
linked with it... anybody have any ideas? I am having a very similar
problem:
>
old message
FROM: Thomas Hudson
DATE: 2001-06-02 23:01
I'm trying to use a data source with an NSComboBox. I've made
connections for
action and data source to my combo box, and set the attributes of the
combo box
to use a data source. In my data source object I implement:
- (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
- (id)comboBox:(NSComboBox *)aComboBox
objectValueForItemAtIndex:(int)index;
When I run the app in the debugger I can see that
numberOfItemsInComboBox is
being called (four times, I believe) before the window appears. When I
click on the
CB button for the drop down, the program crashes with EXC_BAD_ACCESS in
numberOfIemsInComboBox. Moments later PB crashes.
I've made the assumption that my data source can be instantiated in the
nib. At
least it seems this is working, since the appropriate message is being
called.
Are there any examples around of using an NSComboBox with a data source?
Thomas
>
end of old message
In my case, my datasource is trying to get the comboBox values from an
array of arrays. I can print out any value from the array in
numberOfItemsInComboBox: so it doesn't seem to be a memory issue.
objectValue.... seems to be called only when the user clicks on the
box for the drop down; but sometimes the app crashes with SIGSEV
immediately after the screen is shown. My code looks like this:
(provList is an array of arrays):
- (id)comboBox:(NSComboBox *)aComboBox
objectValueForItemAtIndex:(int)index
{
NSLog(@"in combo box obj value");
return [[provList objectAtIndex:index] objectAtIndex:0];
}
- (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox
{
NSLog(@"in combo box # of items");
return [provList count];
}
any ideas most welcome.
carrie
_______________________________________________
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.