On 9.12.2008, at 0:01, Graham Cox wrote:


Use a custom drag type for your ship objects.

Definitely DO NOT use image size as a way to identify the ship! That's just.... weird.

Learn about MVC (Model-View-Controller). Your ship objects are part of the model, which could include a list of possible ships, and a list of those ships which are at sea. Then your drag-n-drop operation really is just a cover for simply moving ship objects between the two lists. The shipsviewcontainer and the view that shows them at sea are just views that visualise the contents of your model.

If you forget about (for the moment) the way stuff is represented on screen and instead work on developing a model that accurately represents the various states of the system, you should find that questions about how to visualise things and other UI-level stuff like drag-n-drop become obvious. It sounds to me that right now you're trying to make your views be the model, which is a whole bag of hurt ;-)

hth,

Graham

In fact I have my ships the grid and the cells in my model level, teh controllers (AppController, which is in charge of the logic of the game, and ViewController, which is in charge of controlling the output) in a controller level, and the views are, well, in a view level. Last night when I went to bed I realize myself that I was making mistake trying to identify the ship my image size, I asked myself what if the image size change? well, then yes what you say is better, in the ShipsContainerView I will instantiate each ship, I will put each object in the pb and then in the destination I will get the object, that should be the best way.

Thanks for your help

G

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to