Hello,
In the following code I analyze a textView , split it to lines , try to build a 
Model object from each line , and if  build failed I want to color that line in 
red. I use setColor:range , but once called this method colors my entire view ( 
also previous lines ) in red. Can someone tell me what I do wrong?
Thanks, David Kramf

 def textView(textView,doCommandBySelector:sel)
       puts "#{sel.to_s}"
       return false if sel.to_s != "insertNewline:"
       puts " in doCommandBySelector selector is #{sel}"
       @newline = true
       enum = @textView.string.lines(seperaotr=$/)
       @location = 0
       enum.each_with_index do |l,i|
            puts "location is #{@location}"
            words = l.split
            line = Line.new(words[0],words[1])
            @lines[i] = line if @lines[i] != line
            red = NSColor.redColor
            range = NSMakeRange(@location,l.length)
            puts "#{range.location}-#{range.length}"
            @textView.setTextColor(red,range) if line.rule  == nil
            @location = @location + l.length
       end
       false
    end
    

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

Reply via email to