• 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: NSTable View Selected Cell question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTable View Selected Cell question


  • Subject: Re: NSTable View Selected Cell question
  • From: "Marcus S. Zarra" <email@hidden>
  • Date: Fri, 12 Aug 2005 09:31:11 -0600

Set up an outlet for the tableview in your controller and then you can ask
the table view for it's selected row and column.

NSTableView:

- (int)selectedColumn;
- (int)selectedRow;

Then you can reselect using:

- (void)selectColumnIndexes:(NSIndexSet *)indexes
byExtendingSelection:(BOOL)extend
- (void)selectRowIndexes:(NSIndexSet *)indexes
byExtendingSelection:(BOOL)extend

On 8/12/05, Bruce Truax <email@hidden> wrote:
> I have an NSTableView which displays arranged objects from an NSArray.
> After editing a cell in the table it is necessary to update the array. I
do
> this by observing changes in key paths. This works well except that after
I
> edit a cell and repopulate the array (and hence the table via bindings)
the
> highlighted row changes to the first row. This is rather annoying. I would
> prefer that the selected cell remain selected but it is not obvious how to
> do this. I can retrieve the selected row using [NSTableView selectedRow]
> but [NSTableView selectedColumn] always returns -1 so I cannot easily get
> the column selected. My questions are:
>
> 1. How can I get the indices of the selected cell.
>
> 2. After updating my table, how can I reselect the cell determined in 1.
>
> Bruce
> --
> ____________________________________________________________
> Bruce E. Truax email: email@hidden
> Optical Engineering Consultant
>
> Diffraction Limited Design LLC
> 388 Wedgewood Road voice: 860-276-0450
> Southington, CT 06489 fax: 860-620-9026
> http://www.dld-llc.com
> _____________________________________________________________
>
>
> _______________________________________________
> 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
>
 _______________________________________________
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

  • Follow-Ups:
    • Re: NSTable View Selected Cell question
      • From: Bruce Truax <email@hidden>
References: 
 >NSTable View Selected Cell question (From: Bruce Truax <email@hidden>)

  • Prev by Date: Re: NSToolbar - dynamic button addition
  • Next by Date: Re: grouping items in toolbar
  • Previous by thread: NSTable View Selected Cell question
  • Next by thread: Re: NSTable View Selected Cell question
  • Index(es):
    • Date
    • Thread