• 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: programmatically updating an MO's attribute/field {MOC is updated, but data is NOT stored}
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: programmatically updating an MO's attribute/field {MOC is updated, but data is NOT stored}


  • Subject: Re: programmatically updating an MO's attribute/field {MOC is updated, but data is NOT stored}
  • From: "Frederick C. Lee" <email@hidden>
  • Date: Tue, 31 Jan 2006 14:23:01 -0800

I'm trying to be able to load a particular set of MO attributes into a common edit area, the 'main' screen.

The 'main screen' is a split screen shared by a NSImageView and a NSTextView (a geographical map and info).

I have a series of panels (sheets) that are specific to a particular MO in a hierarchy.

For example:  [Region] -->> [Countries] --->> [Provinces] ---> [Cities]

Each level of the hierarchy has the same structure, inherited from a common abstract parent.
Hence each level has its own memo (NSAttributeString).


They all share access to a [Map] entity that contains their respective maps.

The user can select a [Region] sheet or .... a [Cities] sheet.

Of course, the cities sheet contains a stack of NSPopUpButtons to reflect the hierarchy.

Example:  [Regions].......[Cities] [cityMaps].

The user selects the particular Map of a Geographical Entity (Region...Cities) which
populates the MAIN viewing area comprised of split panel (map/info).


I thought that the user can enter a memo, etc. in the MAIN viewing area, and then
update the respective Entity somehow; mindful of the fact that the receiving target can change
per selected geographical entity.


Hence:

[Main NSTextView] ---- (1:1) ---> [region memoData]  or...
[Main NSTextView] ---- (1:1) ---> [country memoData] ... etc.

I thought there would be a clean way of doing this, programmatically.

But considering the potential memory links and bugs, perhaps I should just
stick with an unbound MAIN view area and merely COPY the contents between


the sheet's NSTextView (currently not in design) and the Main (at the front-end)
versus back-end MO update.


This would make the sheet bigger, adding the NSTextView which would be copied
to the Main NSTextView; vs merely selecting the object and do the editing solely
within the Main view.


Your observation/critique is warmly appreciated!

I guess I should just keep it simple.

Ric.




On Jan 30, 2006, at 2:47 PM, Matt Neuburg wrote:

On or about 1/30/06 12:15 PM, thus spake "Frederick C. Lee"
<email@hidden>:

I've decided to populate the binary 'memoData' field to avoid a
layout error.
The MOC appears okay before saving.    But the Save (without error)
doesn't actually
save the memoData.

Any Ideas?

Ric.

1) The Code:

     EntityManagedObject *theObject = [[gvRegionMapController
selectedObjects] objectAtIndex:0];
     NSAttributedString *myString = [[NSAttributedString alloc]
initWithString:@"Hello World!"];
     NSData *myData = [NSData dataWithData:[NSArchiver
archivedDataWithRootObject:myString]];

     [theObject setValue:myData forKey:@"memoData"];

     [gvRegionMapController removeObject:[[gvRegionMapController
selectedObjects] objectAtIndex:0]];
     [gvRegionMapController addObject:theObject];

     [theObject release];
     [myData release];

You've got memory management problems out the wazoo here. (And I still don't
understand why you're removing the object only to add it again.) m.


--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide -
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.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
  • Prev by Date: Re: xcodes deployment
  • Next by Date: Re: Geometric shapes with Ink Services
  • Previous by thread: matrixes, custom cells, prototypes, and drawing
  • Next by thread: any of you developers for hire?
  • Index(es):
    • Date
    • Thread