discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with NSTableView and NSPopUpButtonCell


From: Germán Arias
Subject: Re: Help with NSTableView and NSPopUpButtonCell
Date: Tue, 23 Feb 2010 21:45:41 -0600

I think this is a bug. Even, if I close and open again SimpleAgenda,
when I want edit the task, the popup isn't placed under the cursor. 

El dom, 21-02-2010 a las 21:56 +0100, Philippe Roussel escribió:
> Hi all,
> 
> For the task view in SimpleAgenda I'm using a NSTableView with 2
> columns, the first one using an NSPopUpButtonCell.
> 
> The code to set/get the cells' values hasn't change for a while (I
> think) but I can't get it to work with gnustep-gui 0.17.1. I can set the
> value correctly using the popup but the popup buttons don't show the
> selected value.
> 
> This is how I set the cell for this column :
> 
> NSPopUpButtonCell *cell = [NSPopUpButtonCell new];
> [cell addItemsWithTitles:[Task stateNamesArray]];
> [[taskView tableColumnWithIdentifier:@"state"] setDataCell:cell];
> 
> and the setter/getter :
> 
> - (id)tableView:(NSTableView *)aTableView 
> objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
> {
>   Task *task = [[_sm allTasks] objectAtIndex:rowIndex];
> 
>   if ([[aTableColumn identifier] isEqualToString:@"summary"])
>     return [task summary];
>   /* this doesn't work */
>   /* [task state returns an interger between 0 and 3 */       
>   return [NSNumber numberWithInt:[task state]];
> }
> /* I think the following works */
> - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject 
> forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
> {
>   Task *task = [[_sm allTasks] objectAtIndex:rowIndex];
> 
>   if ([[task store] writable]) {
>     [task setState:[anObject intValue]];
>     [[task store] update:task];
>   }
> }
> 
> Any ideas ?
> 
> You can get the latest code with 'svn co 
> svn://coyote.octets.fr/gnustep/SimpleAgenda/trunk SimpleAgenda'
> 
> Thanks,
> Philippe





reply via email to

[Prev in Thread] Current Thread [Next in Thread]