[MacRuby-devel] programatic binding (undefined bind method on NSTextField) SOLVED

Matt Aimonetti mattaimonetti at gmail.com
Wed Sep 28 08:11:51 PDT 2011


Thanks for the update.

- Matt

Sent from my iPhone

On Sep 28, 2011, at 4:54, Alex Greif <alex at greifdesign.net> wrote:

> In the macirb I forgot to import 'Cocoa'. ANd in my App it seems that I
> had a typo.
> 
> it now works now.
> 
> Thanks
> 
> 
>> I even tried it on lion with the latest nightly build, and even there I
>> get "false" for the respond_to?
>> 
>> Do I have to install something else beside macruby?
>> Or Why is the protocol not automatically added to the NSObject class?
>> 
>> Thanks,
>> Alex.
>> 
>>> Have you got the right signature? Looking at
>>> 
>>> http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Protocols/NSKeyValueBindingCreation_Protocol/Reference/Reference.html
>>> 
>>> I see only
>>> 
>>>  bind:toObject:withKeyPath:options:
>>> 
>>> and on Lion with macruby_nightly-2011-09-23 I get:
>>> 
>>> irb(main):014:0>
>>> NSObject.alloc.init.respond_to?('bind:toObject:withKeyPath:options:')
>>> => true
>>> irb(main):015:0>
>>> NSTextField.alloc.initWithFrame([1,2,3,4]).respond_to?('bind:toObject:withKeyPath:options:')
>>> => true
>>> 
>>> Cheers,
>>> Sven
>>> 
>>>> The following code prints false twice
>>>> So it seems that the protocol is not applied correctly.
>>>> Is this a bug or do I need some other require/framework statements?
>>>> BTW the result is the same if i use "framework 'Cocoa'"
>>>> -------- code -------------
>>>> framework 'AppKit'
>>>> 
>>>> puts NSObject.alloc.init.conformsToProtocol
>>>> Protocol.protocolWithName('NSKeyValueBindingCreation')
>>>> 
>>>> puts NSTextField.alloc.initWithFrame([1,2,3,4]).conformsToProtocol
>>>> Protocol.protocolWithName('NSKeyValueBindingCreation')
>>> 
>>> 
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> 
>> 
>> 
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> 
> 
> 
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


More information about the MacRuby-devel mailing list