Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Sven Schwyn
> If the file's owner is the controller, you should not be adding a controller > object to the nib, because then you will wind up with two of them. Makes sense. And reading a little on File's Owner, it seems to be the right choice - at least for other than the MainMenu.xib. Setting up a separat

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Scott Ribe
On Mar 1, 2011, at 3:31 PM, Sven Schwyn wrote: > Turns out that it works if I hook the window outlet to File's Owner instead > of the Preferences Controller delegate. (The amount of at first sight > reasonnable ways to do things can be confusing at times.) If the file's owner is the controller,

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Sven Schwyn
Turns out that it works if I hook the window outlet to File's Owner instead of the Preferences Controller delegate. (The amount of at first sight reasonnable ways to do things can be confusing at times.) Thanks for your hints! -sven ___ MacRuby-deve

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Robert Payne
You probably need to load it differently PreferencesController.alloc.initWithWindowNibNamed See apples documentation to make sure you're using the correct API. -Robert Sent from my iPhone On Mar 2, 2011, at 10:50 AM, Scott Ribe wrote: > On Mar 1, 2011, at 2:46 PM, Sven Schwyn wrote: >

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Scott Ribe
On Mar 1, 2011, at 2:46 PM, Sven Schwyn wrote: > On Mar 1, 2011, at 9:37 PM, Scott Rybe wrote: >> Is the window hooked up to its controller? (Which is probably first >> responder?) > > Well, I've dragged the window outlet of the delegate "Preferences Controller" > onto the window object and cha

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Sven Schwyn
On Mar 1, 2011, at 9:37 PM, Scott Rybe wrote: > Is the window hooked up to its controller? (Which is probably first > responder?) Well, I've dragged the window outlet of the delegate "Preferences Controller" onto the window object and changed the File's Owner class to PreferencesController. ___

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Scott Ribe
On Mar 1, 2011, at 2:34 PM, Sven Schwyn wrote: > eventhough the delegate appears to be hooked up okay. Is the window hooked up to its controller? (Which is probably first responder?) -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Sven Schwyn
Forgot to mention that I've tried preferences.windows.center() already, however, preferences.window is nil and therefore the center method call kabooms. (If I check the "visible at launch", the window shows and window is still nil - eventhough the delegate appears to be hooked up okay.) By the

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Robert Payne
Hi Sven, Actually it's preferences.window.center() preferences.window.makeKeyAndOrderFront(self) Sorry! -Robert On Mar 2, 2011, at 8:19 AM, Sven Schwyn wrote: > Hi Franco > > Thanks for the quick reply. However, I get this if I try your hint: > > undefined method `center' for # > I seem t

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Sven Schwyn
Hi Franco Thanks for the quick reply. However, I get this if I try your hint: undefined method `center' for #http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Re: [MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Robert Payne
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

[MacRuby-devel] Focus window from second XIB

2011-03-01 Thread Sven Schwyn
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 windowNibNam