Re: Troubles with popUpCell and tableview
Re: Troubles with popUpCell and tableview
- Subject: Re: Troubles with popUpCell and tableview
- From: kubernan <email@hidden>
- Date: Wed, 11 Sep 2002 22:23:11 +0200
Hello,
Thx for your help. Of course there was a mistake in my posted code :
NSTableColumn *tabColumn = [NSTableColumn alloc]; // <<-- forget the
init
tabColumn = [tab tableColumnWithIdentifier:@"function"];
It was a test code.
Now using this :
for (z = 0; z < i; z++) // i is the number of rows
{
NSLog(@"current row : %d ", z);
NSLog(@"Index of item : %d\n", [[[tab
tableColumnWithIdentifier:@"function"] dataCellForRow:z]
indexOfSelectedItem]);
}
works better : I don't have error message anymore. But i have
**always** the same indexOfSelectedItem
for different rows with different selected item inside i.e :
If i have two rows in the table view, and for each row one
popUpButtonCell where selected
items are different, my log gives always the selected item of the
popUpButtonCell of the last row :
current row : 0
Index of item : 2 // wrong : this is the not item index of the first
// popUpButtonCell
current row : 1
Index of item : 2 // OK
In fact, the first log (current row : 0) should return (in my test) 1
instead of 2.
Instead of reading directly in the tableview, is there a mean to read
the selected item
from the date source (the NSMutableArray associated to the tableview)
with something like
that (not compiled) :
// "records" is the data source
NSMutableDictionary *aRow = [NSMutableDictionary
dictionaryWithDictionary:[records objectAtIndex:z]];
theSelectedItem = [[aRow objectForKey:@"function"] intValue] // where
"function" is the identifier of the col
Any idea ?
Thx.
K.
Le mercredi, 11 sep 2002, ` 15:58 Europe/Paris, jean Bousquet a icrit :
>
le 10/09/02 17:12, email@hidden `
>
email@hidden a icrit :
>
>
> NSTableColumn *tabColumn = [NSTableColumn alloc];
>
> tabColumn = [tab tableColumnWithIdentifier:@"function"];
>
> ....;
>
> [tabColumn release];
>
>
> This works perfectly under the debugger. But a problem appears AFTER
>
> this code (but i'm not able
>
> to locate where exactly) ; i have a strange message :
>
>
>
> 2002-09-10 11:41:27.569 NNK S.E 4[928] *** -[NSCFSet width]: selector
>
> not recognized
>
> 2002-09-10 11:41:27.584 NNK S.E 4[928] *** -[NSCFSet width]: selector
>
> not recognized
>
>
>
> The message comes several times (i can have a lot).
>
> The GUI is completely frozen. If i delete the for... loop, all works
>
> well. I think this is because of this code :
>
> [arrayOfIndex addObject:[NSNumber numberWithInt:[[tabColumn
>
> dataCellForRow:i] indexOfSelectedItem]]]
>
>
>
> Why it generates a problem ? Is there another way to read the selected
>
> item of each popupcell ?
>
> Any idea ?
>
>
NSTableColumn *tabColumn = [NSTableColumn alloc];
>
tabColumn = [tab tableColumnWithIdentifier:@"function"];
>
.....
>
[tabColumn release];
>
>
Here is probably a problem
>
You alloc tabColumn but redefine it the line after
>
and finally release what you redefined but not what you alloced.
>
Try to delete the 2 lines :
>
NSTableColumn *tabColumn = [NSTableColumn alloc];
>
[tabColumn release];
>
and tell me what happens
>
Hope will help
>
Jean
>
_______________________________________________
>
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.