From: Fabian Holler Date: 2008-08-18T04:21:46+09:00 Subject: Ncurses: problem with Colors & removing existent windows --------------enig0B2067A4C61999C554CA7064 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Hello, I'm trying to write a little Linux Console application with Ncurses. To=20 have an easier Window interface for my purposes I created an Window class= =2E 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=20 is still on the screen 2. I don't get it work to have colored windows/text :/ Whats wrong in my class? #I initialize ncurses with: @scr =3D Ncurses.initscr() #init ncurses mode Ncurses.raw() Ncurses.noecho Ncurses.cbreak Ncurses.stdscr.keypad(true) ' Ncurses.start_color() Ncurses.refresh ---- class Window=20 include Ncurses attr_reader :height, :width def initialize(title, height, width, x, y) @title=3Dtitle @height=3Dheight @width=3Dwidth @x=3Dx @y=3Dy @win =3D 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=3D0 #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] =3D=3D :Bold @win.attrset Ncurses::A_BOLD else @win.attrset Ncurses::A_NORMAL end Ncurses::mvwprintw @win, y+=3D1, 1, i[0].to_s.chomp() end refresh end def delete @win.delete end end ---- many thanks and best regards Fabian --------------enig0B2067A4C61999C554CA7064 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkioewcACgkQeki1sRhDXQAGGACcCHdJX282m+qtVuFszXz6UlQa dfcAoIuUeyhAXECjk/U/3PzvWSmLLUXN =9Zjl -----END PGP SIGNATURE----- --------------enig0B2067A4C61999C554CA7064--