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: Fred Kiefer
Subject: Re: Help with NSTableView and NSPopUpButtonCell
Date: Wed, 24 Feb 2010 10:36:34 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.5) Gecko/20091130 SUSE/3.0.0-1.1.1 Thunderbird/3.0

I fixed this in GNUstep gui SVN. The popup button cell didn't
synchronise it's title when the object value is set. I am not sure if
the fix is at the correct point. We could move it further down into the
selection handling of this class, but then the popup menu uses the same
methods and I am not sure, whether we want to synchronise there.

Hope this helps
Fred

Am 21.02.2010 21:56, schrieb Philippe Roussel:
> 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]