FW: [Glade-users] Want to set colors of widgets...



I should have sent to the user group at large, so anyone can answer...


-----Original Message-----
From:   Friedrich Steven E CONT CNIN 
Sent:   Monday, September 11, 2000 16:35
To:     'Damon Chaplin'
Subject:        RE: [Glade-users] Want to set colors of widgets...

Thanks for the info...  I am now able to set the background color from code,
but I still can't do it from an rc file.  I keep reading the GTK v1.2
Tutorial by Tony Gale and Ian Main, but I just don't get it.  Is there a
better tutorial on using rc files?

In my main.c (that Glade generated) I added:
gtk_widget_set_name (app, "app");               /* app is the name of my
gnome app, created by gnome_app_new */
gtk_widget_set_name (dock1, "dock1");   /* when I created the app with
Glade, I created a scrollable pane */
gtk_widget_set_name (fixed1, "fixed1"); /* that contains a fixed layout */

gtk_rc_parse ("lcp.rc");        /* doesn't seem to care if it precedes or
follows above code */

My lcp.rc file:
style "lcp"
{
        bg[NORMAL] = {0,0,0}
}

# I've tried all the below, to no avail */
widget "app.dock1.fixed1" style "lcp"
widget "app.dock1" style "lcp"
widget "app" style "lcp"
widget "fixed1" style "lcp"


Steven Friedrich
DynTel Corporation
Unit One, Box 611
Bldg 64 - NW Corner
Crane, IN  47522
812-854-2621

        -----Original Message-----
        From:   Damon Chaplin [SMTP:damon helixcode com]
<mailto:[SMTP:damon helixcode com]> 
        Sent:   Sunday, September 10, 2000 06:42
        To:     Friedrich Steven E CONT CNIN
        Cc:     'glade-users helixcode com'
        Subject:        Re: [Glade-users] Want to set colors of widgets...

        Friedrich Steven E CONT CNIN wrote:
        > 
        > Ok, I'm new to GTK, Gnome, and Glade, so please don't flame me.
        > 
        > We're developing a system that will include a maintenance
application that
        > will allow a tech to exercise the system, etc.  We're attempting
to use
        > Glade, Gnome, and GTK.  We want to be able to set the background
color of
        > the main window (a gnome_app widget) to black.  I looked thru many
tutorials
        > and various docs, and I can't find out how.  I saw a section about
GTK rc
        > files, and attempted to use that, but it didn't work for me.
        > 
        > We specifically are NOT interested in creating an application with
a
        > "universal" look and feel, though I understand the desire when
making an app
        > for general distribution.  Our app is intended for a very small
audience.

        rc files do work, and are probably the best way to customize colors.

        The other way is to call gtk_widget_modify_style(), something like
this:

        GtkRcStyle *rc_style = gtk_rc_style_new();

        /* This tells it which attributes you are modifying. */
        rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_BG;

        rc_style->bg[GTK_STATE_NORMAL].red = 0xffff;
        rc_style->bg[GTK_STATE_NORMAL].green = 0;
        rc_style->bg[GTK_STATE_NORMAL].blue = 0;

        gtk_widget_modify_style (widget, rc_style);


        Damon


        _______________________________________________
        Glade-users maillist  -  Glade-users helixcode com
<mailto:Glade-users helixcode com> 
        http://lists.helixcode.com/mailman/listinfo/glade-users
<http://lists.helixcode.com/mailman/listinfo/glade-users> 





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