Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman
Ah. So the typedef changes depending on the platform. Interesting, thanks. Nick Zitzmann wrote: On Jun 21, 2008, at 9:13 AM, Daniel Richman wrote: Thanks! I don't know why they introduced NSInteger. It sounds like it would be a subclass of NSNumber. They did that so that NSData, etc. can

Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Nick Zitzmann
On Jun 21, 2008, at 9:13 AM, Daniel Richman wrote: Thanks! I don't know why they introduced NSInteger. It sounds like it would be a subclass of NSNumber. They did that so that NSData, etc. can hold a 63-bit amount of data in 64-bit applications while not shattering backward compatibility

Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman
That's it! Thanks! Daniel Charles Srstka wrote: Don't do this: NSLog(@"selected row: %@", [tableView selectedRow]); Instead, do this: NSLog(@"selected row: %u", [tableView selectedRow]); Trying to interpret an int as an object is what's causing your crash. Charles On Jun 21, 2008, at 10:

Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Charles Srstka
Don't do this: NSLog(@"selected row: %@", [tableView selectedRow]); Instead, do this: NSLog(@"selected row: %u", [tableView selectedRow]); Trying to interpret an int as an object is what's causing your crash. Charles On Jun 21, 2008, at 10:13 AM, Daniel Richman wrote: Thanks! I don't know w

Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman
Thanks! I don't know why they introduced NSInteger. It sounds like it would be a subclass of NSNumber. That didn't seem to be the problem, though. The program still crashes only when you aren't deleting the first item. I made a movie of it; it's at http://danielrichman.com/tmp/ToDoList_Problem

Re: getting the selected object from an NSTableView causes problems

2008-06-20 Thread Graham Cox
I ran into a very similar problem just today. There is an error in your code though, unrelated to my problem, but is probably yours: int selectedRow = [((NSNumber *)[tableView selectedRow]) intValue]; -selectedRow simply returns an int, so all that casting to an NSNumber* and fetching i

getting the selected object from an NSTableView causes problems

2008-06-20 Thread Daniel Richman
Hi All, I've got an NSTableView that displays the data in an NSMutableArray. (The program is a to-do list.) I just tried adding a function to allow you to delete an item: you select the item in the table and then click delete. My code is as follows: - (IBAction)deleteItem:(id)sender { int