Hi Sven,

Creating a window wont necessarily make it the Key or Main window. What I tend 
to do is always disable the "visible at launch" checkbox inside interface 
builder and do something like

def menu_preferences(sender)
        preferences = PreferencesController.new
        preferences.center()
        preferences.makeKeyAndOrderFront(self)
end

-Robert


On Mar 2, 2011, at 8:11 AM, Sven Schwyn wrote:

> Hi
> 
> For the preferences, I've created a second XIB. However, when the 
> corresponding controller is instantiated, the window does appear but does not 
> gain focus. Any idea what I'm doing wrong here?
> 
> preferences_controller.rb:
>  class PreferencesController < NSWindowController  
>    def windowNibName()
>      return "Preferences"
>    end
>  end
> 
> application_controller.rb:
>  def menu_preferences(sender)
>    preferences = PreferencesController.new
>  end
> 
> The Preferences.xib has a delegate which points to PreferencesController 
> which has it's window outlet point to the window. The File's Owner is also 
> set to the PreferencesController.
> 
> Thanks for your help!   -sven
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to