Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread steve ross
Brian-- Thanks for the great explanation. I'm going to have to rethink how my object achieves a known initial state. Steve On Jan 21, 2010, at 6:41 PM, Brian Chapados wrote: > > Hi Steve (et al), > > So, there are a couple things going on here. Cocoa classes use the > concept of a "designat

Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread Brian Chapados
Hi Steve (et al), So, there are a couple things going on here. Cocoa classes use the concept of a "designated initializer" method, which is a name for the instance method that calls the initializer method of the superclass. This chain continues until you hit [NSObject#init]. To figure this out fr

Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread Edward Moy
This sounds like: https://www.macruby.org/trac/ticket/250 Any subclass of a native Objective C class will fail to call initialize. I do have a fix, but I've been working on other things at the moment. I'll try to finish up and get back to 250 as soon as I can. Ed On Jan 21, 2010, at 4:33 PM

Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread steve ross
So that confirms my suspicion. It's not so much a MacRuby thing as a Cocoa thing. I just don't see how to set an initial state in a class that's instantiated when a nib is loaded. I don't do the alloc.initWithWhatever. On the previous subject though, adding super/self does not cause the initiali

Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread Matt Aimonetti
Sorry I replied too quickly and didn't read properly. Overwriting the init method of a Cocoa class subclass is not recommended. Here is an example of what I was suggesting: http://github.com/mattetti/phileas_frog/blob/master/image_layer.rb#L44 Which then get called there: http://github.com/matte

Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread steve ross
So, this class doesn't reopen a Cocoa class, it subclasses it. Same anyhow? The real problem is that the class is instantiated as a side effect of nib loading, and the only place I've been able to successfully set initial state is awakeFromNib. I either can't, or don't know how to make the nib l

Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread Matt Aimonetti
When reopening a Cocoa class, you should not overwrite initialize and if you were to do it anyway, don't forget to call super and to return self. The Cocoa way is to create your own initializer to end up with something like DuplicateCounterTextField.alloc.initWithDuplicate Also, remember that when

[MacRuby-devel] My class's initialize not called

2010-01-21 Thread steve ross
I'm sure this is an elementary question, but I have the class below. In IB, I set several NSTextField controls to this class. Everything works in the blah, blah, blah part, but strangely enough the puts "initialize dctf" never seems to be called. Any thoughts as to why? require 'strings' cla