Hey Mark,

Thanks for this, but it points out one confusion i have. If I thought it would 
be fine to just have MIDIInstrument in the nib, everything would be simple. But 
my (mis)understanding was that putting the MIDIInstrument in the nib would only 
apply to that single instance. Is that not correct? I need to be able to create 
an arbitrary number of MIDIInstrument objects, programmatically (actually, in a 
kind of "Instrument set-up" NSTableView), and for that reason I've avoided 
putting an instance of MIDIInstrument in the nib... 

So, currently, the nib doesn't contain any MIDIInstrument object at all. I load 
MIDIInstrument objects using a "+" button connected to "add" in an 
NSArrayController for MIDIInstruments, which adds rows to an NSTableView. The 
table gives the name, port, channel of the new MIDIInstrument, with default 
values, which the user can then set as desired (just double-click for name, and 
PopUpButtonCells for port and channel). 

Anyway, I do like the sound of your design... So, does the instance loaded in 
IB become a one-off, or does it somehow "alias" (for lack of a better word) all 
future instances? I was under the impression that the instance in IB was just a 
single instance, and that it wouldn't have any effect on future instances.

thanks a lot.

J.




On 2010-05-18, at 5:06 PM, Mark Ritchie wrote:

> On 18/May/2010, at 4:28 PM, James Maxwell wrote:
>> What I'm not understanding is how to allow newly created MIDIInstrument 
>> objects to read the available/enabled ports from Central_MIDI_Controller. I 
>> know this is probably really simple, but how do I grab a reference to a 
>> controller object loaded only in the MainMenu.nib file?
> 
> Hey James,
> I would do it this way:
> Modify the nib file containing the MIDIInstrument so that FilesOwner is class 
> Central_MIDI_Controller.
> Create an outlet on MIDIInstrument which would point to 
> Central_MIDI_Controller.
> In IB, wire up the outlet from MIDIInstrument to FilesOwner.
> Finally change the code which loads the nib containing MIDIInstrument to pass 
> the one instance of Central_MIDI_Controller as the FilesOwner.
> The unarchiving process will handle connecting up the bits at runtime.
> HTH,
> M.

James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
[email protected]
[email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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