Re: gtk_widget_modify_bg on a GtkTextView



On Sun, 2003-09-21 at 23:13, Ari Pollak wrote:
Hi, I'm currently using Gtk2-perl for a small application (I'm so glad
I found this module, I put this off for a while becuase I thought there
was no Gtk2 module, and doing this in C would have been incredibly
time-consuming).

My problem is that when trying to set the default background color of a
GtkTextView, no change seems to take place. According to the API docs,
you should be able to set the properties of an entire TextView with the
gtk_widget functions. Gtk2::Widget->modify_font() works fine, but
Gtk2::Widget->modify_bg() has no effect. Is this supposed to happen with
a TextView? Any ideas? Following is some example code:

my $window = Gtk2::Window->new ('toplevel');
my $view = Gtk2::TextView->new;
my $color = Gtk2::Gdk::Color->parse('green');
$view->modify_bg('normal', $color);

Try $view->modify_base('normal', $color); here instead. modify_bg is for
widgets like buttons etc, but for text things you want to use
modify_base. From the API docs:

--
Sets the base color for a widget in a particular state. All other style
values are left untouched. The base color is the background color used
along with the text color (see gtk_widget_modify_text()) for widgets
such as GtkEntry and GtkTextView. See also gtk_widget_modify_style().
--

$window->add($view);
$window->show_all;
Gtk2->main;

What should happen is that the background color changes to green, but
this never happens.

James



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]