Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Editing NSBrowserCells



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.