• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do I get the (int)Value of an NSStepperCell in an NSTableView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I get the (int)Value of an NSStepperCell in an NSTableView?


  • Subject: Re: How do I get the (int)Value of an NSStepperCell in an NSTableView?
  • From: Judith Maria Nefertari Dohmann <email@hidden>
  • Date: Wed, 21 Apr 2004 23:32:34 +0200

Thank you for answering, and giving me hope by your positive
report, now I have got it too. It seems that my earlier approach
was way to complicated, now I have:

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int) rowIndex{
NSString *key = [aTableColumn identifier];
Entry *entry = [entries objectAtIndex: rowIndex];
return [entry valueForKey: @"number"];

}
- (void)tableView:(NSTableView *)aTableView setObjectValue: (id) anObject
forTableColumn:(NSTableColumn *)aTableColumn row:(int) rowIndex{
NSString *key = [aTableColumn identifier];
Entry *entry = [entries objectAtIndex: rowIndex];
[entry setNumber: [anObject intValue]];
[tableView reloadData];

}

where Entry is an object, just containing a float (with ints I always
got warnings concerning ints converted to pointers), which is
returned by number and modified by setNumber.

Thank you very much for your help,

Judith Dohmann

Am 21.04.2004 um 09:03 schrieb James Chen:

Hi,
I wrote a simple testing program.
It works. But I also find out there's something you might miss.
That is the cell's settings.
At the beginning, I forgot to set the min/max value of the cell and increment amount.
So nothing happened.
After I set these attributes, it works fine for me.
You may set these at IB or pragmatically.
HTH,
James
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
On Apr 21, 2004, at 2:24 PM, Judith Maria Nefertari Dohmann wrote:


Am 21.04.2004 um 04:46 schrieb James Chen:

Hi,
I never use a NSStepperCellsv as the Table View's cell.
But I think the value of the NSStepperCells shall be set/get via data source protocol.
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
return [NSNumber numberWithInt:[[myMutableArray objectAtIndex] value]];
}
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
[[myMutableArray objectAtIndex] setValue:[anObject intValue]];
// I'm not sure the table view whether reload the row or not.
// If not, you should reload it to synchronize the text cell and stepper.
// [aTableView reloadData];
}
HTH,
James
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------

Thank you for trying, but it does not seem to help.
This morning I tried to put the StepperCells and my numbers into my array, so
that I can return both from my array, but my problem stays more or less the same,
the steppers stay at their values (now 5 and 7), but do not change.
I have to go to the university now, I will continue this evening.

On Apr 20, 2004, at 1:56 PM, Judith Maria Nefertari Dohmann wrote:

Dear listmembers,

I still have trouble with cells in NSTableView s.
I want to have a NSTableView with two columns, in the first one
are numbers in the second are NSStepperCells which I want to
use to change the numbers. I put this together in InterfaceBuilder.

In my datasource-object I have an NSMutableArray which contains
the entries of the first column.

But now I am stuck, I have no idea how to get/set the values of the
steppers and the corresponding numbers.

I have also tried to connect my two steppercell to an action which
only prints the intValues of the steppercell via NSLog, but there
I get only the values 1 and 2, 1 usually in the first row, 2 in the
second (but after a second click), independent of the arrow
I click (up or down).

Any help or links to tutorials where this is described would be really
appreciated.

Thanks,

Judith Dohmann
_______________________________________________
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.


References: 
 >How do I get the (int)Value of an NSStepperCell in an NSTableView? (From: Judith Maria Nefertari Dohmann <email@hidden>)
 >Re: How do I get the (int)Value of an NSStepperCell in an NSTableView? (From: James Chen <email@hidden>)
 >Re: How do I get the (int)Value of an NSStepperCell in an NSTableView? (From: Judith Maria Nefertari Dohmann <email@hidden>)
 >Re: How do I get the (int)Value of an NSStepperCell in an NSTableView? (From: James Chen <email@hidden>)

  • Prev by Date: RE: PrintInfo and page margins
  • Next by Date: Re: Miniature view
  • Previous by thread: Re: How do I get the (int)Value of an NSStepperCell in an NSTableView?
  • Next by thread: Question Applescript - Cocoa Double click on divider of NSsplitview
  • Index(es):
    • Date
    • Thread