Re: Editable NSBrowser
Re: Editable NSBrowser
- Subject: Re: Editable NSBrowser
- From: Brian Webster <email@hidden>
- Date: Wed, 19 Jun 2002 09:10:14 -0500
On Tuesday, June 18, 2002, at 06:15 PM, cocoa-dev-
email@hidden wrote:
One way might be to use NSCell's - (void)editWithFrame:(NSRect)aRect
inView:(NSView *)controlView editor:(NSText *)textObj
delegate:(id)anObject event:(NSEvent *)theEvent; but that requires some
parameters I have no idea how to obtain (like the view, editor,
event...). There must be an easier way... I hope.
The editWithFrame:... method is definitely the one you want to
use. As for the parameters, you'll want something along these
lines. This is code typed in Mail, so no guarantees as to its
exact correctness.
NSCell *selectedCell = [myBrowser selectedCell];
NSRect cellFrame;
NSMatrix *theMatrix;
int selectedRow, selectedColumn;
//these might be slightly different depending on what cell you
want to edit
selectedColumn = [myBrowser selectedColumn];
selectedRow = [myBrowser selectedRowinColumn:selectedColumn];
theMatrix = [myBrowser matrixInColumn:selectedColumn];
//note that the matrix itself only has one column, so we pass in 0
cellFrame = [theMatrix cellFrameAtRow:selectedRow column:0];
[selectedCell editWithFrame:cellFrame
inView:theMatrix
editor:[[myBrowser window]
fieldEditorForObject:selectedCell]
delegate:self
event:nil];
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.