K
Karl Gabel
Hello,
is there any way to bring some color into the Gtk::TextView for some lines?
example:
this line is black
this line is black
this line is red
this line is black
...
I use the Gtk::TextBuffer.insert_at_cursor(text) function, because I
generate a lot of lines dynamically.
@textv_w = @glade.get_widget("textview1")
@buf = @textv_w.buffer
but if I like to change the color ...
def text_color(color)
#Gdk::flush
@textv_w.modify_text(Gtk::STATE_NORMAL, Gdk::Color.parse(color))
@buf= @textv_w.buffer
end
@buf.insert_at_cursor("this should be black")
text_color("red")
@buf.insert_at_cursor("this should be red")
text_color("black")
@buf.insert_at_cursor("this should be black again")
... the whole thing is black.
I even tried to use the TextBuffer.text=(text) function.
Gdk::flush does not work at all.
Is there any way to flush the buffer before changing the color like
$stdout.flush?
Thanks!
Karl
is there any way to bring some color into the Gtk::TextView for some lines?
example:
this line is black
this line is black
this line is red
this line is black
...
I use the Gtk::TextBuffer.insert_at_cursor(text) function, because I
generate a lot of lines dynamically.
@textv_w = @glade.get_widget("textview1")
@buf = @textv_w.buffer
but if I like to change the color ...
def text_color(color)
#Gdk::flush
@textv_w.modify_text(Gtk::STATE_NORMAL, Gdk::Color.parse(color))
@buf= @textv_w.buffer
end
@buf.insert_at_cursor("this should be black")
text_color("red")
@buf.insert_at_cursor("this should be red")
text_color("black")
@buf.insert_at_cursor("this should be black again")
... the whole thing is black.
I even tried to use the TextBuffer.text=(text) function.
Gdk::flush does not work at all.
Is there any way to flush the buffer before changing the color like
$stdout.flush?
Thanks!
Karl