At 12:23 PM -0800 3/20/99, Patrick Robinson wrote:
> A week or so ago, David Neumann wrote, in response to Bob Stuart:
>
>> This is a matter of taste and trade-offs. I don't care if the DG isn't
>> in synch. Next time my users access the app the page they get back will
>> be in synch. Should they ever try to make a state change to the
>> database, EOF makes sure everything's in synch and that nothing changed
>> under me. I am ensured that I can synch up just-in-time.
>
> I'm not sure I understand what this means...  Let's say I have a DG
> that's displaying an array of items.  And I have a link (or button)
> on this page that does two things: (1) adds a new item via the DG's
> insert method, and (2) takes the user to a page to edit the new EO's
> attributes.  On this second page, he can Save or Cancel the addition
> of the new item.


< weird, annoying behaviors with the traditional WO Component Wizard 
editing metaphor deleted>


 Ah, someone else who doesn't like the way that the WO wizards do things.

 You want the more traditional UI metaphor: New brings up a dialog 
box which you fill in and click save.

 This is how _I_ did that, I'm not sure its the best way.

 When you go to the new page, all you have to do is allocate a new 
object of whatever type:

Person *personEdit;

- awake
{
  personEdit = [[Person alloc] init];
  // you can fill in defaults here
}

  All of your page stuff is then linked to personEdit rather then 
displayGroup.selectedObject.

  In your save button:

- savePerson
{
        [[[self session] defaultEditingContext] insertObject: personEdit];
        [self.session.defaultEditingContext: saveChanges];
}

Translation:

   You can make objects that exist independently of the database. In 
the "New item, but don't insert into the database until confirmation" 
case, that's what you want. So in -awake, you make yourself a new 
object.

   Then [[[self session] defaultEditingContext] insertObject: personEdit];

  Tells EO that said object should be added to the database, along 
with any objects it points to.

 What I'm not sure of:

  If I need a:

- sleep
{
        [personEdit release];
}

 I think I don't need it in WebScript (what I'm using), but you do in ObjC.

 Pierce
----------------------------------------------------------------
  Pierce T. Wetter III, Director, Twin Forces, Inc.
  e-mail: [EMAIL PROTECTED]  Phone:520-779-4227
  <http://www.twinforces.com/>
U.S. Mail: 1300 South Milton Rd, Suite 206, Flagstaff, AZ 86001

Reply via email to