Re: color label in windows ??
| From: | Steph | Date: | Thu, 14 Mar 2002 00:56:26 +0000 |
| Subject: | Re: color label in windows ?? | ||
| References: | 1 2 3 4 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1519@lists.php.net to get a copy of this message | ||
eek ... sorry, I was testing a label in a button with a shared style ..
Alan's right, you need to add it to an event box (same for many things with GtkLabel) because
it has no background. And there's me thinking, 'well okay so it has no window but .. ?)
This works:
<?
dl('php_gtk.'.(strstr(PHP_OS, 'WIN') ? 'dll' : 'so'));
$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_CENTER);
$window->connect_object('destroy', array('gtk', 'main_quit'));
$event = &new GtkEventBox();
$oldstyle = $window->style;
$newstyle = $oldstyle->copy();
$yellow = &new GdkColor('yellow');
$newstyle->bg[GTK_STATE_NORMAL] = $yellow;
$event->set_style($newstyle);
$label = &new GtkLabel('testing the colour theory');
$event->add($label);
$window->add($event);
$window->show_all();
gtk::main();
?>
----- Original Message -----
From: "Roberto Villarreal" <roberto.villarreal@funktiontech.com>
To: <php-gtk-general@lists.php.net>
Sent: Thursday, March 14, 2002 12:08 AM
Subject: Re: [PHP-GTK] color label in windows ??
> Thank you both... I could not change de bg color of the label but the fg...
>
> Alan, Php-Mole rules!! it helps me when i dont know how to do something. I
> found there almost all the functions that can be used in any basic program.
> Thank You! ... mmm.. one more question... i know it may sound (or read) a
> little stupid, but... What is Php-mole for? i think i cannot find all the
> functionality due im running it over win32, but really... i dont know how
> could i use it... but well, it is a very good aplication, congratulations
> and thank you again.
>
>
> Roberto Villarreal
>
> ----- Original Message -----
> From: "Alan Knowles" <alan@akbkhome.com>
> To: "Steph" <Steph.Fox@btinternet.com>
> Cc: "Roberto Villarreal" <roberto.villarreal@funktiontech.com>;
> <php-gtk-general@lists.php.net>
> Sent: Wednesday, March 13, 2002 5:39 PM
> Subject: Re: [PHP-GTK] color label in windows ??
>
>
> > AFAIK - you can not change the background color of a label - its one of
> > the gtk's faq - I cant remember the work around - it was probably that
> > you have to add the label to another widget. - if not try #gtk or #gnome
> > - someone might squeek an answer or suggestion - otherwise find another
> > gtk program that does something similar.. and look at the code..
> >
> > you should be able to changed the foreground (fg) however.
> > regards
> > alan
> >
> > Steph wrote:
> >
> > >try 'bg' instead of 'base'
> > >
> > >----- Original Message -----
> > >From: "Roberto Villarreal" <roberto.villarreal@funktiontech.com>
> > >To: <php-gtk-general@lists.php.net>
> > >Sent: Wednesday, March 13, 2002 5:40 PM
> > >Subject: [PHP-GTK] color label in windows ??
> > >
> > >
> > >Hi... I was wondering if I can set a color in a label in windows... I
> know it can be done, but i followed an example in the mailing list but it
> didn´t work for me... Here is my code, it doesnt work and it doesnt print
> any error message.. the label is still black :(
> > >
> > > $label_n = &new GtkLabel($label);
> > > $estilo_actual = $label_n->get_style();
> > > $estilo_nuevo = $estilo_actual->copy();
> > >
> > > $color = &new GdkColor('#FFFFFF');
> > >
> > > $estilo_nuevo->base[GTK_STATE_NORMAL]=$color;
> > >
> > > $label_n->set_style($estilo_nuevo);
> > >
> > >Thanks for your help.
> > >
> > >Roberto Villarreal
> > >
> > >
> > >
> >
> >
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>