Ncurses: problem with Colors & removing existent windows

Hello,

I’m trying to write a little Linux Console application with Ncurses. To
have an easier Window interface for my purposes I created an Window
class.

  1. How i can delete an existing windows + its content from the screen?
    AFAIK it should work with clear(), but doesn’t work, the window+content
    is still on the screen

  2. I don’t get it work to have colored windows/text :confused:
    Whats wrong in my class?

#I initialize ncurses with:
@scr = Ncurses.initscr() #init ncurses mode
Ncurses.raw()
Ncurses.noecho
Ncurses.cbreak
Ncurses.stdscr.keypad(true) ’
Ncurses.start_color()
Ncurses.refresh


class Window

include Ncurses
attr_reader :height, :width
def initialize(title, height, width, x, y)
@title=title
@height=height
@width=width
@x=x
@y=y
@win = Ncurses::WINDOW.new(height,width,x,y)
refresh
#Ncurses.init_pair(0, Ncurses::COLOR_RED, Ncurses::COLOR_GREEN);
end
def refresh
@win.box(0,0)
@win.mvaddstr(0, 1, " #{@title} ")
@win.refresh
end
def clear
@win.clear
end
def addtxt(txt)
return if txt[0].nil?
y=0
#COLORS Test
Ncurses.start_color()
Ncurses.init_pair(0, Ncurses::COLOR_RED, Ncurses::COLOR_GREEN);
@win.color_set(Ncurses::COLOR_PAIR(0),nil)
@win.attron(Ncurses::COLOR_PAIR(0))
Ncurses::attron(Ncurses::COLOR_PAIR(0))
#/COLORS Test

   txt.each do |i|
     if i[1] == :Bold
       @win.attrset Ncurses::A_BOLD
     else
       @win.attrset Ncurses::A_NORMAL
     end
       Ncurses::mvwprintw @win, y+=1, 1, i[0].to_s.chomp()
      end
 refresh

end
def delete
@win.delete
end
end

many thanks and best regards

Fabian