• 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
How to handle Dropped Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to handle Dropped Data


  • Subject: How to handle Dropped Data
  • From: Michael Petnuch <email@hidden>
  • Date: Sun, 26 Feb 2006 06:54:42 -0500

This is more of a best approach question as I already implement a solution it is just not really elegant (actually really kludgy).

I have a custom Cocoa photo view (which for imaging purposes looks like the main browsing window in iPhoto). The view has bindings enabled and from the binding it gets an array of file paths. In then takes those file paths and creates its own class (called PhotoViewObject), which contains thumbnail images, photo information, etc...

However, the original set of data comes from a MySQL database. The table associated with the photo data has its own class (called PhotoTableObject). On startup an array (called PhotoTableObjectArray) is populated with these PhotoTableObject objects which are bound to an array controller (called PhotoTableObjectArrayController) which is the controller from which the custom view used to get the photo paths. Specifically the custom view binds to the the arrangedObjects of PhotoTableObjectArrayController with the keypath photoPath.

My problem is, when I get a drop onto the custom view of an image I add the photo to the view. But I also want the database to be updated with the new photo. Right now the custom view has all the headers of the PhotoTableObject so that when we get a drop we create a new PhotoTableObject and add that to the array controller. But I don't think my custom view really should know about the PhotoTableObject class.

Unfortunately, I couldn't think of a better way of doing this. I guess what I need to do is sort of have a bidirectional communication. Right now when an object gets added to PhotoTableObjectArray, through bindings the information is sent to the custom view to update itself. But how can I have the opposite happen, when I add something to say the internal array of PhotoViewObject have the PhotoTableObjectArray get updated.

If I wasn't clear on my problems, please let me know. Any help is greatly appreciated!

Thanks.
---------------------------------------------------------------
Michael Petnuch
http://www.petnuch.com
email@hidden



_______________________________________________
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: Accessing MySQL database
  • Next by Date: Re: iTunes like toolbar
  • Previous by thread: Re: kqueue OK in 10.4, not calling back to CFSocket in 10.3
  • Next by thread: Objective-C in a Time Constraint Thread
  • Index(es):
    • Date
    • Thread