[Openmcl-devel] NSSlider not responsive
Osei Poku
osei.poku at gmail.com
Sat Feb 2 17:04:25 PST 2008
On Feb 2, 2008, at 6:16 PM, Gary Byers wrote:
>
> On Sat, 2 Feb 2008, Osei Poku wrote:
>
>>> On Sat, 2 Feb 2008, Osei Poku wrote:
>>>> On thing to note is that when I set the target of the slider's
>>>> action
>>>> to be a simple text label using takeFloatValueFrom:, the slider
>>>> moves
>>>> as expected and can be dragged up and down. Could this be a lisp
>>>> callback issue?
>>
>> On Feb 2, 2008, at 5:34 PM, Gary Byers wrote:
>>
>>> What was the slider's target before you made this change ?
>>
>> The slider's target was the window-controller/WindowController
>> class using the #/slide: message.
>>
>
> It was the class, or an instance of it ?
To an instance of it. Sorry for my imprecise terminology.
I have some update on this problem and the solution was very silly.
Maybe you can explain it.
When my slide: method was defined without a specified return type (ie
(objc:defmethod #/slide ((self window-controller) sender) ...)), the
slider movement was not smooth. When the slide: method was defined
with a :void return type (ie (objc:defmethod (#/slide: :void) ((self
window-controller) sender) ....)) then the slider motion was smooth
and continuously updated the target control as I expect.
>
>
> You defined a #/slide method that would be applicable to any -
> instance-
> of your window-controller class.
>
> The class itself (which in ObjC is an instance of its metaclass;
> that's
> a little different from CLOS, where most classes are instances of
> STANDARD-CLASS) doesn't likely respond to #/slide.
>
> If you want the -class- WINDOW-CONTROLLER to respond to #/slide, you
> need to define the method on that classe's metaclasss (which in the
> bridge would be named +WINDOW-CONTROLLER)
>
> (objc:defmethod (#/slide :void) ((self +window-controller) sender)
> ..)
>
> That method will be applicable to any instance of the metaclass
> +WINDOW-CONTROLLER. There will typically only ever be one
> such instance (the class WINDOW-CONTROLLER), and if that class
> object is indeed the target if the slider's action, the class
> will receive the message.
>
> If having the class wind up as the slider's target was unintentional,
> I'd be tempted to blame IB 3.0 (with the caveats that I haven't done
> much Cocoa stuff in several months and was never -that- comfortable
> with IB 3.0 to begin with.)
>
>
>
More information about the Openmcl-devel
mailing list