GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Text View Color

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
Dimon-z



Joined: 27 Apr 2008
Posts: 2

PostPosted: Sun Apr 27, 2008 6:27 pm    Post subject: Text View Color Reply with quote

How to set TextView text color in C
Back to top
Wolfgang
Familiar Face


Joined: 05 Feb 2008
Posts: 37

PostPosted: Mon Apr 28, 2008 8:19 am    Post subject: Reply with quote

Do you need to change existing text color or to insert new text with specified color?
Back to top
alen121
Familiar Face


Joined: 28 Sep 2007
Posts: 23

PostPosted: Wed Apr 30, 2008 5:23 am    Post subject: Reply with quote

How we can change the text color written in the textview . I used gtk_widget_modify_fg() function . but the color hasnt changed .
Back to top
Wolfgang
Familiar Face


Joined: 05 Feb 2008
Posts: 37

PostPosted: Wed Apr 30, 2008 5:29 am    Post subject: Reply with quote

Code: (C)
1
2
3
4
5
6
7
8
9
void TextColor(GtkWidget *label, long color_)
{
  GdkColor color;
  gchar cname[32];

  g_sprintf(cname, "#%06X", color_);
  gdk_color_parse(cname, &color);
  gtk_widget_modify_text(label,  GTK_STATE_NORMAL, &color);
}

It works for label. Try to call it for GtkTextView
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP