Skip navigation.
 
mlRe: Move NSPanel using Core Animation
FROM : Troy Stephens
DATE : Thu Jan 24 19:14:45 2008

On Jan 24, 2008, at 7:52 AM, Richard Pollock wrote:
> Is it possible to smoothly slide an NSPanel using Core Animation? 
> I've got the following code in a mouseUp: method using the animator 
> proxy (with the goal of having the bottom left corner of my shiny 
> new HUD NSPanel slide under the mouse):
>
> [[MyNSPanel animator] setFrameOrigin:[MyNSWindow 
> convertBaseToScreen:NSMakePoint([event locationInWindow].x,[event 
> locationInWindow].y)]]
>
> With this code, the panel does move, but doesn't *animate* to its 
> new location. I've searched various places around the net but have 
> only come up with documentation/code for moving NSViews rather than 
> NSWindows. Most of these NSView movements seem to use setFrame: with 
> a modified NSRect origin, but surely that's effectively what 
> setFrameOrigin: is doing to my panel?
>
> (Incidentally, core animation is "working" on the panel, as I've 
> been able to successfully fade it in and out using [[MyNSPanel 
> animator] alpha:x])
>
> Is there perhaps something obvious I'm missing here, like certain 
> window style masks needing to be set or specific window ordering/key 
> status?
>
> Thanks,
> Rich


Hi Rich,

Sorry for the confusion; you've hit a known bug.  [[aWindow animator] 
setFrameOrigin:...] should animate, but doesn't.

Use -setFrame:display: instead; that works as intended.

Troy

Related mailsAuthorDate
mlMove NSPanel using Core Animation Richard Pollock Jan 24, 16:52
mlRe: Move NSPanel using Core Animation Troy Stephens Jan 24, 19:14