Re: [MacRuby-devel] Problem with a window controller

2013-03-06 Thread Robert Carl Rice
On Dec 10, 2012, at 11:27 AM, Jean-Denis MUYS wrote: > >> >> On 7 déc. 2012, at 19:48:39, david kramf >> wrote: >>> >>> Message: 1 >>> Date: Fri, 7 Dec 2012 19:48:39 +0200 >>> From: david kramf >>> To: "MacRuby development d

Re: [MacRuby-devel] Problem with a window controller

2012-12-10 Thread david kramf
, David On Dec 10, 2012, at 11:27 AM, Jean-Denis MUYS wrote: > > On 7 déc. 2012, at 19:48:39, david kramf > wrote: >> >> Message: 1 >> Date: Fri, 7 Dec 2012 19:48:39 +0200 >> From: david kramf >> To: "MacRuby development discussions." >>

Re: [MacRuby-devel] Problem with a window controller

2012-12-10 Thread Jean-Denis MUYS
On 7 déc. 2012, at 19:48:39, david kramf wrote: > > Message: 1 > Date: Fri, 7 Dec 2012 19:48:39 +0200 > From: david kramf > To: "MacRuby development discussions." > > Subject: Re: [MacRuby-devel] Problem with a window controller > Message-ID:

Re: [MacRuby-devel] Problem with a window controller

2012-12-09 Thread david kramf
Hi Bob "What I don't like is the way MacRuby supports…" - I hope that MacRuby will improve on that point. I have not encountered that problem yet. > "myClass = MyClass.alloc.initWithArgument( argument )"… - I believe this will > work fine but this is not Ruby. In Ruby( to the best of my knowledg

Re: [MacRuby-devel] Problem with a window controller

2012-12-07 Thread Robert Carl Rice
Hi David, IB will use the default Obj C initialization and, yes, the default Obj C initialization is a little different from Ruby initialization so I have to make minor changes when I change a class from MacRuby instantiation to IB instantiation. The default Obj C initialization calls init wi

Re: [MacRuby-devel] Problem with a window controller

2012-12-07 Thread david kramf
Hi Bob, "As you become more familiar with IB, you will probably do more initialization of objects in IB and less in MacRuby. Nib file expansion instantiates objects and then makes calls to initialize the objects using the same methods that you are using to initialize objects in MacRuby. Actually

Re: [MacRuby-devel] Problem with a window controller

2012-12-06 Thread Robert Carl Rice
Hi David, It does take time to learn to use IB. IB was first presented to me in a small group by none other than Apple employee #1 Steve Wozniak in a small demonstration of the first Mac OS running on a Next Step black box in Tysons Corner, VA. I don't recall the year. In his demo he created an

Re: [MacRuby-devel] Problem with a window controller

2012-12-04 Thread david kramf
Hi Bob I still have to get used to the IB. One of the things I find confusing is that after I define something using the IB I don't see the generated code . I think that initially I will rely less on the IB and more on the code. Many Thanks, David. On Dec 4, 2012, at 9:19 AM, Robert Carl Rice w

Re: [MacRuby-devel] Problem with a window controller

2012-12-03 Thread Robert Carl Rice
Hi David, AppDelegate doesn't inherit from NSWindowController so you would need a MacRuby outlet to obtain a link to the Main Menu window or any other object instantiated in the NIB, but usually you don't need this. This outlet doesn't need to be named "window". You could rename it to something

Re: [MacRuby-devel] Problem with a window controller

2012-12-03 Thread david kramf
Hi Bob I never programmed in Objective-C. When I open a MacRuby project I automatically get a window attar_accessor defined in my AppDelegate created code, but not in the controller which I write by my own. If I connect, using IB , the window to my controller parameter (object variable) , I get

Re: [MacRuby-devel] Problem with a window controller

2012-12-03 Thread Robert Carl Rice
Hi David, You should consider the "window" Objective C property to be "owned" by NSWindowController and it's confusing to define a Ruby class variable with the same name. It should automatically appear as an IB outlet for your NSWindowController subclass that you would "hook up" in IB just as y

Re: [MacRuby-devel] Problem with a window controller

2012-12-02 Thread david kramf
Hi Bob My code crashes if I omit the attr_accessor. Can you refer me to instructions of how to configure the IB to link to my controller as delegate (?) . In the examples I have in my book and ,if I am not mistaken, lectures I viewed in iTunes U ( the Stanford series ), they all used the awake

Re: [MacRuby-devel] Problem with a window controller

2012-12-02 Thread Robert Carl Rice
Hi David, A couple of things I notice offhand in you code: The NSWindowController class defines accessor methods for "window" so you shouldn't redefine it with the Ruby attr_accessor method. Note: similarly NSViewController defines accessor methods for "view". You can configure IB to link the

Re: [MacRuby-devel] Problem with a window controller

2012-12-02 Thread J Silver
Hi David, Try NSLog instead of puts. Also you can override puts to #NSLog. I have some production MacRuby code up at https://github.com/jsilverMDX/GlobalChat2/tree/master/globalchat%202%20OSX that's in the App Store. Look here for an example of a working MacRuby app that uses IB and Sockets.

Re: [MacRuby-devel] Problem with a window controller

2012-12-02 Thread Andy Park
On Sunday, 2 December 2012, david kramf wrote: > Thank you very much Andy and Jim > I followed your remarks , played with the code and I am still surprised. > It turns out that awakeFromNib is called before applicationDidFinishLaunching > so there MyController is already initialized and has the c

Re: [MacRuby-devel] Problem with a window controller

2012-12-02 Thread david kramf
Thank you very much Andy and Jim I followed your remarks , played with the code and I am still surprised. It turns out that awakeFromNib is called before applicationDidFinishLaunching so there MyController is already initialized and has the correct window as the his instance variable. NSWindow

Re: [MacRuby-devel] Problem with a window controller

2012-11-30 Thread Andy Park
Without being able to verify anything for accuracy at the moment, it looks like your window's delegate is not set to the controller at the time the events are occurring. Check if you need to set this - try tracing the window's delegate at different points of the controller's lifecycle. On 30

Re: [MacRuby-devel] Problem with a window controller

2012-11-30 Thread Jim Getzen
Hi David, You might check out this Stack Overflow entry to see if it solves your problem: http://stackoverflow.com/questions/2695671/nswindowcontroller-windowdidload-not-called Jim On Nov 29, 2012, at 6:50 PM, david kramf wrote: Hi, In the copied below code only the awakeFromNib is execute

[MacRuby-devel] Problem with a window controller

2012-11-29 Thread david kramf
Hi, In the copied below code only the awakeFromNib is executed . Can someone explain me what do I do wrong ? Window is displayed and I expected all other methods to be called. Thanks, David class MyController < NSWindowController attr_accessor :window def awakeFromNib @w