Re: Display Groups
Re: Display Groups
- Subject: Re: Display Groups
- From: Nathan Dumar <email@hidden>
- Date: Fri, 23 Jul 2004 12:47:49 -0400
On Jul 22, 2004, at 10:06 PM, Sam Barnum wrote:
One big gripe: insertObject() does NOT return the object being
inserted! It returns null. Get the inserted object by callinng
selectedObject().
Do you mean the method insert()?
When reading the API, it sounded to me like it would overwrite an
existing object if I did not first clear the selection. I also didn't
see anything about the inserted object automatically being selected.
So here's what I did:
userDisplayGroup.clearSelection(); // clears selection so index is at
end of display group
userDisplayGroup.insert(); // inserts the new object at the end,
because selection is cleared
Integer i = (Integer)userDisplayGroup.indexOfLastDisplayedObject() - 1;
// get number of new object
userDisplayGroup.setSelectionIndexes(new NSArray(i); // set selection
to i - the new object
This is according to my understanding of the display group. I may have
done more work than was necessary.
Yet, it's a fine illustration of what Lotsa means when he says,
2. Sometimes (mostly?) they are very difficult to get to behave the
way one wants.
Sometimes it's more trouble to manipulate them than it is to just write
stuff yourself.
Thanks to Art's help (and patience), I've come to appreciate them for
what they are: a specialized tool that can be a great help in a very
specific circumstance. Otherwise, it's easier to skip them and do it
yourself.
Nathan
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.