• 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: Bruce Truax <email@hidden>
  • Date: Fri, 12 Aug 2005 11:42:26 -0400

This is exactly what I did.  - (int)selectedRow returns the correct row but
-(int)selectedColumn always returns ­1.

Bruce


On 8/12/05 11:31 AM, "Marcus S. Zarra" <email@hidden> wrote:

> 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 <mailto: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
>> >
>
>


--
____________________________________________________________
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

References: 
 >Re: NSTable View Selected Cell question (From: "Marcus S. Zarra" <email@hidden>)

  • Prev by Date: Re: grouping items in toolbar
  • Next by Date: Handling application termination in a non-gui application
  • Previous by thread: Re: NSTable View Selected Cell question
  • Next by thread: Robust audio playback using NSSound...
  • Index(es):
    • Date
    • Thread