Is this a bug? I don't see anything quite like it in Trac.

I have a binding to a button's state property. Here's the binding:

   @comboBox.bind 'enabled',
             toObject: @button,
             withKeyPath: 'state',
             options: {
                         NSValueTransformerBindingOption =>
                         OffStateMeansTrueTransformer.alloc.init
                       }

At the point the binding is made, the state of the button is a fixnum 0.

The value transformer is immediately called to set the starting value. Here's the transformedValue code:

 def transformedValue(state)
   puts "state -> bool transforming #{state.inspect}"
        # prints #<NSCFNumber:0x1022180>
        # state.intValue is 0

Because of this, I have to cast the state before making comparisons:

   case state.intValue
   when NSOffState then true
   when NSOnState then false
   else
raise "The value to transform should be either NSOffState or NSOnState."
   end


If this is a bug, I'll write a testcase.

-----
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to