First off, I'm new to IB and cocoa, so these questions should be taken in that context. Also, This is a port of an existing X/C++ app. The internals are tried and true, all I'm doing is adding a new UI.

How do I obtain a reference to an object instanciated in IB?
I have 2 outline views and 2 instances of my datasource class, but I'm not clear how I can contact each instance separately from my code. I need to set a pointer in the datasource pointing to my internal (C++) data structures so that the right data goes to the right view.
I can think of a few ways to do this, but none that are robust or clean.

On a barely related note -
I thought that the 'item' passed from the datasource to the outlineview (returned by outlineView:child:ofItem:) should be opaque to the outlineview, so I was passing a reference to a C++ object. This however crashed my app whenever the disclosure triangle was clicked. It seems that the runtime system was monkeying with my data, expecting it to be am obj-c entity when it wasnt. I got round it by creating an obj-c wrapper class and wrapping each C++ item before passing it to the outlineview. This seems horribly inefficient to me, I have thousands of items in my data trees.

Also: do I need to track and clean up all these wrapper instanes? I'm assuming I dont - I hope I dont otherwise it'll be a complete nightmare.


Many thanks for any help or insight.


paulm

_______________________________________________

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 arch...@mail-archive.com

Reply via email to