Re: NSMovieView & movie controller separating :-0
Re: NSMovieView & movie controller separating :-0
- Subject: Re: NSMovieView & movie controller separating :-0
- From: Andy Lee <email@hidden>
- Date: Fri, 1 Mar 2002 01:18:32 -0500
Weird! I just reproduced your problem myself in a quick test. I now have something working that doesn't have the splitting-up problem, but it's not very reassuring. I'll give you the whole story in case something rings a bell.
I found the following in the NSView doc:
-----snip-----
None of the methods that alter an NSView's frame rectangle redisplays the NSView or marks it as needing display. When using the setFrame... methods, then, you must mark both the view being repositioned and its superview as needing display. This can be as simple as marking the superview in its entirety as needing display, or better, marking the superview in the old frame of the repositioned view and the view itself in its entirety. This code fragment sets theView's frame rectangle, and updates its superview appropriately:
NSView *theView; /* Assume this exists. */
NSRect newFrame; /* Assume this exists. */
[[theView superview] setNeedsDisplayInRect:[theView frame]];
[theView setFrame:newFrame];
[theView setNeedsDisplay:YES];
-----snip-----
I tried code that uses the above pattern, but it didn't help at all, which leads me to suspect there is a bug in NSMovieView.
I tried sending an explicit display message to the content view at the end of the method. For some reason this helped, but only partially. The two parts of the NSMovieView didn't get split up any more, but the controls part was mucked up.
Finally, after a few more random guesses, I tried removing and re-adding the NSMovieView to its superview. My actual code looks like this:
- (void)testAction:(id)sender
{
NSMovieView *mv = (NSMovieView *)thing;
NSView *superView = [mv superview];
NSRect newFrame = NSOffsetRect([mv frame], 10, 10);
[mv removeFromSuperview];
[superView setNeedsDisplayInRect:[mv frame]];
[superView addSubview:mv];
[superView display];
}
This "works" in the sense that things get redrawn the way I wanted in the first place, but it shouldn't be necessary to muck with the view hierarchy, even temporarily, to get a moved subview to display properly.
--Andy
At 10:52 PM -0600 2/28/02, Michael P. Rogers wrote:
>
hello,
>
>
I'm trying to animate an NSMovieView, by repeatedly calling this method through an NSTimer:
>
>
-(void)moveMovieViews
>
{
>
NSRect newFrame = NSOffsetRect([leftMovie frame], 1,1);
>
[leftMovie setFrame:newFrame];
>
[[theBigScreen contentView] setNeedsDisplay:YES];
>
}
>
>
where leftMovie is an NSMovieView *, and theBigScreen is the NSWindow *.
>
>
Unfortunately, the content area of the movie and its movie controller (the bar underneath the movie with the controls) split up -- the controller moves in the right direction as expected, but the movie proper stays in one place, until I ever-so-slightly resize the NSWindow.
>
>
I've tested this with several QuickTime trailers, always with the same result.
>
>
Why won't the NSMovieView move as one? I have a hunch that I might have to subclass NSMovieView and override movieRect, but I'd rather not, if possible.
>
>
Thanks,
>
>
Michael
>
--
>
---------------------------------
>
Dr. Michael Rogers
>
e-mail: email@hidden
>
Phone: 217-424-6327
>
>
For information about Computer Science at Millikin University, visit http://math.millikin.edu
>
For information about astronomy, check out http://twincityamateurastronomers.org
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.