Re: Array Controller Add method question
Re: Array Controller Add method question
- Subject: Re: Array Controller Add method question
- From: mmalcolm crawford <email@hidden>
- Date: Sat, 06 Dec 2008 19:58:04 -0800
On Dec 6, 2008, at 7:15 PM, email@hidden wrote:
I'm using an Array Controller's Add method wired to a button to
enable text
data entries into a table. How do I set the table to activate it's
top row
when pressing the Add button in preparation for input? At this
point if the
table contains many rows of data and the user clicks the Add button
the
table's lowest row activates. The user is forced to scroll down to
the very
bottom of the table prior to entry
int row = [a indexOfObjectIdenticalTo:p];
[tableView editColumn:0 row:row withEvent:nil select:YES];
a = your array controller/arrary
p = object added
The OP asked for the item to be added at the top, so that doesn't
help...
You need to make sure you insert the new object at the right place in
the array controller's arranged objects.
One approach is to implement a new action method in your document/
application controller:
- (IBAction)newAtTop:sender {
id newObject = [arrayController newObject];
[arrayController insertObject:newObject atArrangedObjectIndex:0];
[tableView editColumn:0 row:0 withEvent:nil select:YES];
[newObject release];
}
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden