Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8041295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:09:54+00:00 2026-06-05T04:09:54+00:00

My Setup XCode 4.3.2 MacRuby 0.12 (ruby 1.9.2) [universal-darwin10.0, x86_64] Latest nightly as of

  • 0

My Setup

  • XCode 4.3.2
  • MacRuby 0.12 (ruby 1.9.2) [universal-darwin10.0, x86_64]
    • Latest nightly as of 4 Jun, 2012
  • OS 10.7.3

Goal

Have a window with some controls in a separate XIB from MainMenu.xib and be able to open that window programmatically. I do not want it to open at launch.

Attempts

  1. I made a new xib (Woot.xib) and created a window in it
  2. I made a new Ruby class

    class WootController < NSWindowController
        attr_accessor :window
        def windowNibName
             return 'Woot'
        end
    end
    
  3. I tried to set the class of File’s Owner in the Woot.xib to be WootController, but found that it will not if < NSWindowController is in my class definition. If I remove the < NSWindowController from the class definition, then the outlets populate and I can link the window in XIB to the window outlet in my class.
  4. From inside my AppDelegate’s applicationDidFinishLaunching method, I’ve tried

    Attempt

    newWind = WootController.new
    puts newWind #outputs "#<AddCredentialsDialog:0x400191180>"
    newWind.window().makeKeyAndOrderFront(self) # results in no method error for nil
    

    Attempt 2

    newWind = WootController.initWithWindowNibName 'AddWindow'
    puts newWind #outputs "#<AddCredentialsDialog:0x400191180>"
    newWind.window().makeKeyAndOrderFront(self) # results in no method error for nil
    

Questions

  1. Why don’t either of my attempts work? I’ve ready just about everything I can find on macruby and using NSWindowController.
  2. Why can’t I link my class WootController if I have it inheriting from NSWindowController
  3. Is there a different way to do this other than putting it all in MainMenu.xib?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:09:55+00:00Added an answer on June 5, 2026 at 4:09 am

    This solution works

    nib = NSNib.alloc.initWithNibNamed('Woot', bundle: nil)
    newWind = WootController.new
    nib.instantiateNibWithOwner(newWind, topLevelObjects:nil)
    newWind.showWindow(self)
    

    Some things to note

    1. In Macruby, if there are named parameters to a method signature, you must use them even if you just specify nil or the method signatures don’t match up and you get a no method error.

      ie. obj.foo('hello', to_whom: nil) is not the same as obj.foo('hello')

    2. If there are named parameters you must use parentheses.

      ie. this obj.foo('hello', to_whom: nil) will work, not this obj.foo 'hello', to_whom: nil

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Setup : Xcode 4.3.1 (or 5.x) OS X 10.7.3 I have reproduced this issue
I have freshly setup app, just with a window an a root view (from
I've created a tabbar application using the template in Xcode, and have setup a
I'm trying to setup my Xcode project to be instrumented with gcov so I
I have a problem when I try to set up Xcode . shown in
I have an Xcode project with several static library dependancies set up in the
I have a Jenkins job set up that builds my iOS Xcode project and
I have a pretty simple set up here, and Xcode is giving me a
How can i setup my Xcode project so that it creates new class files
I'm consolidating my Xcode/TextMate setup and is interested in where you put your build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.