Question

I have two NSTableViews. On double clicking on the tableview1 the contents of the tableview1 will be placed in tableview2. I would like to edit the new cell in the tableview2. Tried the following method.

- (void)editColumn:(NSInteger)columnIndex row:(NSInteger)rowIndex withEvent:(NSEvent *)theEvent select:(BOOL)flag

This does not make the tableview2 as firstResponder. The cursor is not in the new cell. I would like to have the cursor in the new cell and start editing the cell. Please give me some pointers to accomplish this. Thanks in advance.

How to bring the cursor in the cell of NSTableView?

Was it helpful?

Solution

When the editing started ,fieldEditor comes into picture thats why not able to set the firstResponder.

Implemented the textDidEndEditing delegate of the tableView. It solved the isssue.

OTHER TIPS

If you are using a NSArrayController to hold the data of your tables, you could override rearrangeObjects:

- (void)rearrangeObjects {
    [super rearrangeObjects];
    [tableView editColumn:0 row:[self selectionIndex] withEvent:nil select:YES];
}

An additional advantage is that this method also seems to scroll the table down to the newly inserted row.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top