Editing NSBrowserCells
Editing NSBrowserCells
- Subject: Editing NSBrowserCells
- From: Russell <email@hidden>
- Date: Sat, 30 Sep 2006 12:16:56 +0100
Hi, I'm trying to set up an editable NSBrowser and have just run up
against a brick wall. I'm implementing NSCell's - (void)
editWithFrame:(NSRect)aRect
inView:(NSView *)controlView editor:(NSText *)textObj
delegate:(id)anObject event:(NSEvent *)theEvent method to set up the
editing. I've decided to initially set the editing to work on a
double click. The problem is that although the cell text is made
available for editing it appears white against a white background.
I've tried to set the colour of the text with
setUpFieldEditorAttributes:(NSText *)textObj but this doesn's seem to
work. What does seem to work is to reload the column of the browser
containing the cell by adding a new cell to the browser or by
reloading the column in the textDidBeginEditing delegate method. I've
included the code I've got so far below.
- (void)handleDoubleClicks:(id)sender
{
NSBrowserCell *selectedCell;
NSRect cellFrame;
NSMatrix *theMatrix;
int selectedRow, selectedColumn;
NSText *fieldEditor;
selectedCell = [browser selectedCell];
selectedColumn = [browser selectedColumn];
selectedRow = [browser selectedRowInColumn:selectedColumn];
theMatrix = [browser matrixInColumn:selectedColumn];
cellFrame = [theMatrix cellFrameAtRow:selectedRow column:0];
fieldEditor = [[browser window] fieldEditor:YES
forObject:selectedCell];
[selectedCell setEditable:YES];
[selectedCell setSendsActionOnEndEditing:YES];
[selectedCell setUpFieldEditorAttributes:fieldEditor];
[selectedCell editWithFrame:cellFrame inView:theMatrix
editor:fieldEditor delegate:self event:nil]
}
Any help would be much appreciated!
_______________________________________________
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