[MacRuby-devel] Anonymous class

2010-05-17 Thread Wladj
Hi, in a little macruby-cocoa app when i try to save a simple hash (attribute of a model class) inside the fileWrapperOfType method via Marshal.load( Marshal.dump(@model.data)) #deep copy , i get an error: `fileWrapperOfType:error:': can't dump anonymous class # (TypeError) i discover that th

Re: [MacRuby-devel] Using a context with addObserver

2010-05-17 Thread Dave Baldwin
Digging a bit more I think a solution to my own questions is: On 13 May 2010, at 14:33, Dave Baldwin wrote: > I am trying to translate code that looks like this: > > static NSString *SKTWindowControllerCanvasSizeObservationContext = > @"com.apple.SKTWindowController.canvasSize"; > > and later

Re: [MacRuby-devel] KVC: different behaviour with set and =

2010-05-17 Thread B. Ohr
Ooops, shame on me, you are right. Now it is working…. Am 17.05.2010 um 10:20 schrieb Vincent Isambart: >> class Controller < NSWindowController >> attr_accessor :test >> def works >>setTest true >> end >> def doesnotwork >>test = true >> end >> end > > "test = true" should be "sel

Re: [MacRuby-devel] KVC: different behaviour with set and =

2010-05-17 Thread Vincent Isambart
> class Controller < NSWindowController >  attr_accessor :test >  def works >    setTest true >  end >  def doesnotwork >    test = true >  end > end "test = true" should be "self.test = true" "test = true" just creates a local variable named test. It's a very common mistake in Ruby. _

Re: [MacRuby-devel] KVC: different behaviour with set and =

2010-05-17 Thread B. Ohr
Hi! Oh sorry, my first message was a little bit too short. In the IB I created a button and on the bindings pane I connected the hidden property to Controller, the ‚Model Key Path‘ is set to 'Controller.self.test‘. Now when I am calling ‚work‘ the button gets hidden, but with ‚doesnotwork‘ the

Re: [MacRuby-devel] KVC: different behaviour with set and =

2010-05-17 Thread Thibault Martin-Lagardette
Hi ! What exactly is not working? You said you have "Controller.self.test", what do you mean by that? Both setX and X= work for me, here is what I get: $> cat t.rb class A attr_accessor :someAttr end a = A.new a.setSomeAttr "set via #setSomeAttr" p a.someAttr a.someAttr = "set via #someAttr

[MacRuby-devel] KVC: different behaviour with set and =

2010-05-17 Thread B. Ohr
I have a binding of an user interface element to my controller (Controller.self.test): The setTest does work, but the 'test =' does not. class Controller < NSWindowController attr_accessor :test def works setTest true end def doesnotwork test = true end end Is this a bug?