Hi,
I've setup an NSOutlineView which displays items of a data acquisiton system
this way
+-LocationName
+--InstrumentNameA
+----DataTypeNameA1
+----DataTypeNameA2
+----DataTypeNameA3
+
+--InstrumentNameB
+----DataTypeNameB1
+----DataTypeNameB2
…
So as you see the DataTypes (like Voltage) is a child of an Instrument (e.g:
Voltmeter)...
Now I want to have a NSButtonCell for all the DataTypeNames (leaf node of the
OvItem items class)…I've setup an NSOutlineView with 2 columns: first column
named
"buttonColumn" and a second one to display the Items…
I've tried to generate the buttons with the NSOutlineView delegate method
"outlineView:dataCellForTableColumn:item:" but it just show all the buttons
for every row/items:
Here's what I tried so far:
- (NSCell *)outlineView:(NSOutlineView *)outlineView
dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
//printf("delegate column identifier: %s\n", [[tableColumn identifier]
cStringUsingEncoding:NSASCIIStringEncoding]);
NSCell* returnCell = [tableColumn dataCell];
NSTableColumn *checkboxColumn = [outlineViewChannels
tableColumnWithIdentifier:@"buttonColumn"];
if ( ![(OvItem *)item isGroup] )
{
if ( [[tableColumn identifier] isEqualToString:@"buttonColumn"] )
{
NSButtonCell *cell = [[NSButtonCell alloc] init];
[cell setButtonType:NSSwitchButton];
[cell setTitle:@""];
[cell setEnabled:YES];
[cell setTransparent:NO];
[checkboxColumn setDataCell:cell];
[cell release];
}
}
return returnCell;
}
I've even tried with another delegate method:
outlineView:willDisplayCell:forTableColumn:item: but this didn't work either
and takes a lot of overhead since it
refreshes everytime the user clicks / scrolls in the outline view...
Does someone have a clue how I can fix this ?
Any suggestion(s) are greatly appreciated,
--Gilles
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]