Forum: Ruby-Gnome 2 cursor-color in a Gtk::TextView

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mac Tuitui (Guest)
on 2007-01-19 17:30
(Received via mailing list)
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...
Kouhei S. (Guest)
on 2007-01-19 18:34
(Received via mailing list)
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...
This topic is locked and can not be replied to.