Mailing Lists: Apple Mailing Lists

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

Re: NSTable View Selected Cell question



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

This email sent to email@hidden

References: 
 >Re: NSTable View Selected Cell question (From: "Marcus S. Zarra" <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.