Re: Changing Text Color for GTK_ENTRY Widgets




----- "Emmanuel Rodriguez" <emmanuel rodriguez gmail com> wrote:
> 2009/2/26  <r richardparker comcast net>:
> > I have several top-level windows which contain fill-in forms designed with
> > GLADE 3 that contain GtkTextEntry Widgets for data to be stored in a
> > PostgreSQL database. I'm validating the entries and when I find one that's
> > invalid, I'd like to change its text color to "red" and then post a message
> > box indicating that there were errors on the form. How do I change the text
> > color in these GTK_ENTRY widgets? These are not labels, but single-line text
> > entry fields. I'm guessing that Pango would be involved, but how? As it is,
> > a section of my validation code is as follows:
> >
> Here's a derived GtkEntry (in Perl) that can use Pango markup:
> http://cpansearch.perl.org/src/POTYL/Gtk2-Ex-Entry-Pango-0.04/lib/Gtk2/Ex/Entry/Pango.pm
> If you download the bundle you will see some sample code how I use it.
> The code should be straight easily portable to any language.

 

Thanks for your input. I have decided to use the earlier suggestion of Anthony Vallone to create a GdkColor variable and the gtk_widget_modify_text() function to color my GtkEntry fields. This seems to work fine and doesn't involve the complexities of Pango for this purpose. I'll probably look more into Pango when I get into the reporting section of my application. Thanks again (and I apologize if I have posted this response more than once).



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