Ruby Forum Ruby-Gnome 2 > progressbar color??

Posted by Pat Kiatchaipipat (blitzer)
on 20.05.2008 12:17
Attachment: untitled.JPG (2 KB)
hi, this is a basic problem I think but I try to do this for long time.
after I declare

progress = ProgressBar.new

I use

progress.modify_fg(STATE_NORMAL,Gdk::Color.new(240*255,208*255,215*255))

but it's nothing happen

and when I do

progress.modify_bg(STATE_NORMAL,Gdk::Color.new(240*255,208*255,215*255))

color of background of progress bar is a color but I want color at bar
how can I do that?? see my picture for detail.
Posted by Kouhei Sutou (Guest)
on 20.05.2008 16:19
(Received via mailing list)
Hi,

In <83ebd631f07a3bb01fe8b2d40d7f62b1@ruby-forum.com>
  "[ruby-gnome2-devel-en] progressbar color??" on Tue, 20 May 2008 
12:17:35 +0200,
  Pat Kiatchaipipat <ruby-forum-incoming@andreas-s.net> wrote:

> progress.modify_fg(STATE_NORMAL,Gdk::Color.new(240*255,208*255,215*255))
> 
> but it's nothing happen
> 
> and when I do
> 
> progress.modify_bg(STATE_NORMAL,Gdk::Color.new(240*255,208*255,215*255))
> 
> color of background of progress bar is a color but I want color at bar
> how can I do that?? see my picture for detail.

Use Gtk::STATE_PRELIGHT.


Thanks,
--
kou
Posted by Geoff Youngs (Guest)
on 20.05.2008 17:04
(Received via mailing list)
2008/5/20 Kouhei Sutou <kou@cozmixng.org>:
> In <83ebd631f07a3bb01fe8b2d40d7f62b1@ruby-forum.com>
>  "[ruby-gnome2-devel-en] progressbar color??" on Tue, 20 May 2008 12:17:35 +0200,
>  Pat Kiatchaipipat <ruby-forum-incoming@andreas-s.net> wrote:
>> [snipped]
>> color of background of progress bar is a color but I want color at bar
>> how can I do that?? see my picture for detail.
>
> Use Gtk::STATE_PRELIGHT.

IIRC, there's no guarantee that this will work: it will depend on the
GTK theme the user has configured.  (Pixmap themes, for example, will
definitely ignore this - the progress bar is simply an composite of
bitmaps).

If having a particular colour for the bar is really essential, it
would be safer to draw your own using cairo.

HTH,

Geoff.
Posted by Pascal Terjan (Guest)
on 20.05.2008 17:12
(Received via mailing list)
Le mardi 20 mai 2008 à 16:03 +0100, Geoff Youngs a écrit :
> IIRC, there's no guarantee that this will work: it will depend on the
> GTK theme the user has configured.  (Pixmap themes, for example, will
> definitely ignore this - the progress bar is simply an composite of
> bitmaps).
> 
> If having a particular colour for the bar is really essential, it
> would be safer to draw your own using cairo.
> 

You can also enforce the theme for that widget
Posted by Javier Donaire (Guest)
on 20.05.2008 17:36
(Received via mailing list)
2008/5/20 Pat Kiatchaipipat <ruby-forum-incoming@andreas-s.net>:
>
> and when I do
>
> progress.modify_bg(STATE_NORMAL,Gdk::Color.new(240*255,208*255,215*255))
>
> color of background of progress bar is a color but I want color at bar
> how can I do that?? see my picture for detail.


Hi all, I've just joined the list.

Try calling progress.modify_bg with STATE_PRELIGHT instead of 
STATE_NORMAL.
Posted by Pat Kiatchaipipat (blitzer)
on 26.05.2008 17:47
thank you! STATE_PRELIGHT is work!! and I want to know what's different 
of STATE_PRELIGHT and STATE_NORMAL??
Posted by Guillaume Cottenceau (Guest)
on 27.05.2008 00:27
(Received via mailing list)
On Mon, May 26, 2008 at 5:47 PM, Pat Kiatchaipipat
<ruby-forum-incoming@andreas-s.net> wrote:
> thank you! STATE_PRELIGHT is work!! and I want to know what's different
> of STATE_PRELIGHT and STATE_NORMAL??

There's API documentation for that.

http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk#GtkStateType

--
Guillaume Cottenceau - http://zarb.org/~gc/