Re: comboBox crash
Re: comboBox crash
- Subject: Re: comboBox crash
- From: Brock Brandenberg <email@hidden>
- Date: Fri, 17 Jan 2003 22:55:03 -0600
>
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.
I just implemented a combo box with a data source in an application in the
past week. I programmatically messaged the combo box with setUsesDataSource:
first, then setDataSource: second with the id of a data source object that
was instantiated in the nib containing the combo box.
Try setting up your combo box programmatically instead of using the settings
in IB (if that's what you're currently doing). Then make sure that your data
source is returning a valid string. NSLog the index value and also the
object that you think is at that index to make sure that you're returning
valid data for what is requested.
Brock Brandenberg
----- industrial design @ www.bergdesign.com ------
_______________________________________________
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.