Invoking a Method of a Protocol

I would like to animate the opacity change of a window. I can change the opacity easy enough as follows…

Declare Sub SetAlphaValue Lib "AppKit" Selector "setAlphaValue:" (NSView as Integer, alpha As Single)
SetAlphaValue( Self.Handle, 0.3 ) 

To animate the change, it appears I can use the animator proxy as described here, so I tried this…

Declare Sub SetAlphaValue Lib "AppKit" Selector "setAlphaValue:" (NSView as Integer, alpha As Single)
Declare Function getAnimator Lib "AppKit" Selector "animator:" (NSView as Integer) as Integer
SetAlphaValue( getAnimator( Self.Handle ), 0.3 )

However, that gives me an objc error when I try to run it…

-[XOJWindow animator:]: unrecognized selector sent to instance 0x494fa0

The animator method is defined in a protocol that’s implemented by NSView, so my question is, what’s the correct way to define and invoke a method of a protocol?

Any help or insight would be appreciated.

-Steve

“animator:” vs “animator”. You used the wrong name.

Oi! Thanks, Christian! What a silly mistake!

:slight_smile:

-Steve