| Sign In/My Account | View Cart |
| Article: |
Movies and Menus | |
| Subject: | Thanks, some observations | |
| Date: | 2002-02-01 09:58:56 | |
| From: | psheldon | |
|
Response to: It doesn't play mp3's.
|
||
|
I tried all your code and no controller appeared and then I decided to try the contextual menus. The one on the dock worked but not the one in the window. I went back to the original project from the column without resizing and which I had set at a huge window in the IB. Both contextual menus worked and made the controller appear. Now, I have your code to make isolations on. I also did some fooling in IB with allowing a minimimum window size beyond default. That's my priority now. But, I seem to be getting lost so I may bounce between your code isolations too and this. Definitely food for thought. Thanks. |
||
Showing messages 1 through 6 of 6.
I was able to comment out your file types and get some action.
Now, I've lost autoresizing code, for, when I try to use it, the movie window dissappears.
The best I can show you is the code with the resizing stuff commented out so the window doesn't dissappear. I don't know how to make a cleaner isolation or leaner question presentation than showing this.
- (IBAction)openMovie:(id)sender
{
NSArray *fileTypes = [NSArray arrayWithObjects:@"mov", @"mpg",
@"mp3",
//@"MP3",NSFileTypeForHFSTypeCode('MPG3'),//michele
@"jpg", nil];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
int result = [oPanel runModalForDirectory:NSHomeDirectory() file:nil types:fileTypes];
if (result == NSOKButton)
{
//the following were added
NSWindow *window = [NSApp mainWindow];
NSRect frameView = [movieView frame];
NSSize viewSize;
NSArray *movieToOpen = [oPanel URLs];
NSURL *movieURL = [movieToOpen objectAtIndex:0];
NSMovie *movie = [[NSMovie alloc] initWithURL:movieURL byReference:NO];
[movieView showController:YES adjustingSize:YES];//michele
//the following were added (dimamarkman "FileTypes and Resizing" unless otherwise commented)
[window setTitle:[[[oPanel filenames] objectAtIndex:0] lastPathComponent]];
[movieView setMovie:movie];
//the following were added (dimamarkman "FileTypes and Resizing" unless otherwise commented)
//[movieView showController:YES adjustingSize:YES];//michele
//viewSize = [movieView sizeForMagnification:1.0];
//[movieView resizeWithMagnification:1.0];
[window makeKeyAndOrderFront: self];//michele
//viewSize.width = 2*frameView.origin.x + viewSize.width;
//viewSize.height = 2*frameView.origin.y + viewSize.height;
//[window setContentSize:viewSize];
[window display];//michele
}
}