Re: How can I colorize a Gtk::Entry field?



On 11/11/01 Christoph Lorenz wrote:
can anybody please tell me, what is the correct way to colorize a
Gtk::Entry field?

I already tried with ->set_foreground($color) with 
my $color = Gtk::Gdk::Color->parse_color("red");

but it failed with a "
Can't locate object method "set_foreground" via package "Gtk::Entry"
error :(

And is there also a way to "remove" the color settings and to give the
field back its original (defined by the theme) color setting?

You can change the background (and foreground) of a Gtk::Entry changing
it's style the same way you can do with any other widget:

        my $style = new Gtk::RcStyle;
        my $color = {green => 65355, blue=> 0, red 0};
        $color = $widget->get_colormap->color_alloc ($color);
        $style->modify_color (['fg', 'text'], 'normal', $c);
        $widget->modify_style ($style);

lupus

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better



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