NSSliderCell don't change my data.
NSSliderCell don't change my data.
- Subject: NSSliderCell don't change my data.
- From: Jesper Hansen <email@hidden>
- Date: Sat, 9 Jul 2005 20:12:03 +0200
I have used most of my day trying to get a NSSliderCell in a
NSTableView to work without success.
If I set it up in IB it works fine, but I would like to add and
remove the columns programatically, so I figured this should work:
NSTableColumn *newColumn = [[NSTableColumn alloc]
initWithIdentifier:@"test"];
[m_cacheTableView addTableColumn:newColumn];
[[newColumn headerCell] setStringValue:@"Test"];
[newColumn setEditable:YES];
[newColumn bind:@"value" toObject:m_cacheArrayController
withKeyPath:@"arrangedObjects.difficulty" options:nil];
#if 1
NSSliderCell *newCell = [[[NSSliderCell alloc] init] autorelease];
[newColumn setDataCell:newCell];
[newCell setEditable:YES];
[newCell setMinValue:1.0];
[newCell setMaxValue:5.0];
[newCell setContinuous:YES];
#else
NSTextFieldCell *newCell = [[[NSTextFieldCell alloc] init] autorelease];
[newColumn setDataCell:newCell];
[newCell setEditable:YES];
[newCell setFormatter:[[[NSNumberFormatter alloc] init] autorelease]];
#endif
m_cacheTableView is a pointer to a NSTableView.
m_cacheArrayController is a NSArrayController that is bound to some
CoreData objects.
"arrangedObjects.difficulty" is float values.
The Slider cell is correctly displaying the "difficulty " values, but
when I move the slider with the mouse it just jumps back to the
starting position when I release the mouse button.
If I instead use a TextField cell I can successfully edit the data.
I have tried to set miscellaneous options in the bind call, but
nothing seemed to help.
All my googling just turned up examples on how to use
NSTableDataSource's tableView:setObjectValue:forTableColumn:row:
which I assume is unused then using bindings.
--
Jesper Hansen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden