[gtkada] Changing the color of a label

Preben Randhol randhol at pvv.org
Tue Jun 24 11:37:39 CEST 2003


Jean-Pierre Rosen <rosen.adalog at wanadoo.fr> wrote on 24/06/2003 (11:27) :
> I thought an EventBox was for attaching events, but why not...
> Until this point, I understand.

Yes, but it also have a background.

> >       Background_Eventbox_Style :=
> >                Copy (Get_Style (Background_Eventbox));
> > 
> >       -- Now you can set the background colour on the Eventbox.

> ?? I'm lost here. What is this Background_Eventbox_Style variable?
> And how can I set the background colour of the EventBox? I didn't find a
> procedure for that in the RM...

         Set_Rgb (Background_Color, 65_535, 65_535, 65_535);
         --  Note you need to allocate the colour. (see comment below
         --  too)
         if Background_Color /= Null_Color then

            Set_Background (Background_Eventbox_Style,
                            State_Normal,
                            Background_Color);
            Set_Style (Background_Eventbox,
                       Background_Eventbox_Style);
         end if;

However if you want only a white colour there is a function so you don't
have to do the Set_RGB and allocating, but I cannot remember how you did
it in GtkAda 1.x now and I don't have the source. Grep through the
include files for white.

-- 
Preben Randhol -------------- http://www.pvv.org/~randhol/Ada95 --
                 «For me, Ada95 puts back the joy in programming.»



More information about the gtkada mailing list