Hi List,

I'm new to the list and currently I'm struggling with MacRuby (or better: 
Cocoa). I've done some Ruby development (mostly Rails) in the past and think my 
knowledge about ruby is okay. But I've no idea about Cocoa and all I know about 
C are a few fragments C++ back from university...

Currently I try to teach me some MacRuby/Cocoa with hacking together a small 
desktop application. Matt Aimonetti's book is already ordered and I hope it 
will arrive next week. I did some reading back when it was available for free 
on the net. So I already know some (small) things but actually I've some 
questions and I hope I'll find some answers on the list. If this is the wrong 
place to ask such questions, please let me know.

At the moment my application mostly consists of a NSTableView bound to a 
CoreData Entity. Works like expected. In a next step I would like to extend my 
application to open another window to enter the details for adding content. 
I've designed the window in the interface builder (Another.xib) and added 
another ruby file to my project with the following content: 

class AnotherController < NSWindowController
  def windowNibName()
    return "Another"
  end
end
 
I added a NSObject in IB and set it's class to AnotherController. In my 
AppDelegate.rb I've added a method which gets called when selecting a menuitem:

def addItem(sender)
  newWindow = AnotherController.alloc.init
  newWindow.window.makeKeyAndOrderFront(self)
end

Now I can select the menu entry, which is calling addItem, which then opens the 
other window. This is working, but it doesn't feel right. Especially the 
AnotherController things seems a little bit odd to me. Is there a better way to 
do this? What are the next steps? What would be the best way to add another 
record to my CoreData based on the form values of my second window?

I find it generally hard to imagine how to arrange a files in a larger 
MacRuby/Cocoa project. Is there some good reading on this topic?

Regards,
Timo

-- 
twitter.com/orangeorb

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

Reply via email to