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'
class DuplicateCounterTextField < NSTextField
include Strings
attr_accessor :splitter, :completions
attr_accessor :wordCount, :duplicateCount
def initialize
puts "initialize dctf"
@splitter = /\W+/
@wordCount = 0
@cachedWordCount = 0
@duplicateCount = 0
end
# blah, blah, blah working code
def textDidChange(notification)
words = stringValue.split(@splitter)
@wordCount = words.length
@duplicateCount = @wordCount - words.uniq.length
if delegate.respond_to?('controlCountDidChange:wordCount:duplicateCount:')
delegate.controlCountDidChange(self,
wordCount:@wordCount,
duplicateCount:@duplicateCount)
end
end
# etc.
end
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel