Re: how to instantiate MyDocument with file from open panel?
Re: how to instantiate MyDocument with file from open panel?
- Subject: Re: how to instantiate MyDocument with file from open panel?
- From: Michael Dautermann <email@hidden>
- Date: Thu, 6 Dec 2007 12:11:01 -0800
On Dec 6, 2007, at 11:59 AM, Nathaniel Gottlieb-Graham wrote:
I've run an open panel and called the openPanelDidEnd: selector, and
I have the file the user has chosen in an array. Now I'm a little
stuck because I want to do something with that file; I want a new
MyDocument instance to be created and load the data from the file
into a QTMovieView I've set up in IB. I'm unsure how to do this, in
particular instantiating MyDocument. Googling for it indicates very
few hits, so I'm probably approaching the problem the wrong way.
Thanks for the help, all.
I'm assuming each new document has it's own QTMovieView, correct?
If so, then you can instantiate a new document (using "[[ MyDocument
alloc ] init ]" for example) from within openPanelDidEnd and either
pass in the file via a parameter in your init method or some kind of
setter.
When the document is created, you should have it load the data from
that file.
In other words, if your "MyDocument" class have an standard init method:
- (id) init
You can follow up the
MyDocument *newDocument;
newDoc = [[ MyDocument alloc ] init ];
if( newDoc ) // make sure newDoc isn't null
{
// set the document to point to that file
[ newDoc setFile: [ arrayOfFiles objectAtIndex: indexOfFile ]];
}
Does this help??
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden