1

I've created a super simple example application using Macruby. The problem is that the prefpane won't work, nothing happens.

I've created a button, that has a callback in the Main.rb file. When someone clicks on the button the label should change value to "Some data".

The link to the Main.rb file also contains the non working example project.

There is only 3 lines of code added.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Linus Oleander
  • 17,746
  • 15
  • 69
  • 102
  • have you looked at this? http://stackoverflow.com/questions/4581667/interface-builder-not-seeing-outlets-with-macruby I had similar problems until I reinstalled Xcode and then MacRuby. – ian Feb 02 '11 at 15:16

1 Answers1

3

The problems were being shown in your console messages (Console.app). Or if you would start System Preferences.app from the command-line you could have seen the messages there. Anyways, copy-pasting from the commit message:

  • The Main.rb file was never being loaded in the runtime with a call like: require 'Main'.
  • The resources path of the bundle isn't added to the load path by default, so I did this in PrefPane.rb.
  • Why do you really need the Main class instead of using the PrefPane class?
  • You had the `text' outlet of Main hooked up to the content view in the nib, not to the actual text label.

Last but not least, since MacRuby is still a ‘young’ project, I urge people to ask their questions there, so the actual community can help out.

alloy
  • 20,908
  • 2
  • 30
  • 40
  • The reason I dont use the PrefPane class to place my code is because the accessors and methods won't show up in interface builder. I added an example to the project on Github. Here is the code: https://github.com/oleander/MacRubyTesting/blob/37e6801032c6160e95e55e3138a83c452815bbfb/build/Debug/Testing.prefPane/Contents/Resources/PrefPane.rb – Linus Oleander Feb 03 '11 at 11:52
  • Hmm, I guess that might be because IB prefers the objective-c definition over the Ruby one. Can you check if you remove the PrefPane.m/h references from the project IB does pick the Ruby file up? – alloy Feb 03 '11 at 20:56
  • Regardless of that bit about the PrefPane/Main classes, does it now work for you? If so, mind flagging the answer as ‘answered’? :) – alloy Feb 04 '11 at 10:29