Cursor-color in a Gtk::TextView


#1

Hello everyone,

My name is Alexis Andre, and I have been using ruby-gnome2 to develop
simple apps. The only one that I made public can be found at
http://duby.rubyforge.org . It is a clone of filelight.

I tried to post the following yesterday but it was refused without a
reason, so I hope I am doing the right thing in subscribing to the list.
If not, please forgive my stubbornness.

I am using a TextView widget in a really simple text editor, and I
changed the background to black, and the text to green. The problem is
that the cursor stays black, so I can not see it anymore!

I could not find a method to specify the cursor-color neither in
Gtk::Widget nor in Gtk::TextView.
In gtkwidget.c, however, the possibility to change the cursor-color is
available. What have I done wrong? Am I missing a method?

Thanks in advance.

Here is a sample:

require ‘gtk2’
Gtk.init
window = Gtk::Window.new(“Editor”)
window.set_default_size(400,400)
window.signal_connect(“destroy”) do Gtk.main_quit end

view = Gtk::TextView.new
view.wrap_mode=Gtk::TextTag::WRAP_WORD
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC)
window.add(sw)
sw.add(view)
view.modify_base(Gtk::STATE_NORMAL,Gdk::Color.new(0,0,0))
view.modify_text(Gtk::STATE_NORMAL,Gdk::Color.new(0,65535,0))
window.show_all
Gtk.main

########
Andre Alexis


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#2

Hi,

In removed_email_address@domain.invalid
“[ruby-gnome2-devel-en] cursor-color in a Gtk::TextView” on Sun, 14
Jan 2007 15:08:32 +0900,
“Mac Tuitui” removed_email_address@domain.invalid wrote:

I could not find a method to specify the cursor-color neither in
Gtk::Widget nor in Gtk::TextView.
In gtkwidget.c, however, the possibility to change the cursor-color is
available. What have I done wrong? Am I missing a method?

You need to modify style property by RC. Add the following
code to your script before Gtk::TextView.new:

Gtk::RC.parse_string(<<-EOR)
style “green-cursor” {
GtkTextView::cursor-color = “green”
}
class “GtkWidget” style “green-cursor”
EOR

Thanks,

kou


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV