• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Editable NSBrowser
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Editable NSBrowser (Still Broken)
      • From: Evan Cooke <email@hidden>
  • Prev by Date: Re: IB 2.2 Autoresizing problems
  • Next by Date: Re: Categories, Protocols, Delegates and ToolTips
  • Previous by thread: Editable NSBrowser
  • Next by thread: Re: Editable NSBrowser (Still Broken)
  • Index(es):
    • Date
    • Thread