GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Jul 24, 2014 6:27 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [SOLVED] GtkCellRenderer - different font size in edit mode.
PostPosted: Sun Nov 06, 2011 12:14 pm 
Offline
Familiar Face

Joined: Fri Mar 25, 2011 7:55 am
Posts: 35
Location: romania
Hi,

i have this code:
Code:
list = gtk_tree_view_new();
renderer = gtk_cell_renderer_text_new ();
gtk_widget_modify_font( list, pango_font_description_from_string( "Courier New bold 12" ));
gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( list ),
                                                             -1,
                                                             "name",renderer,"text",0,NULL );
g_object_set( G_OBJECT( renderer ), "editable", TRUE, "editable-set", TRUE, NULL );

in view mode all is ok, when i enter in edit mode the font is not "Courier New bold 12", and is very small.
i test this:

g_object_set( G_OBJECT( renderer ), "font", pango_font_description_from_string( "Courier New bold 12" ), NULL );

same result, in edit mode the font is very small.

working !
----------
Code:
void cell_edit_font( GtkCellRenderer *cell,
                          GtkCellEditable *editable,
                          const gchar     *path,
                          gpointer         data ) {
   if ( GTK_IS_ENTRY( editable )) {
      GtkEntry *entry = GTK_ENTRY( editable );
     
      gtk_widget_modify_font( GTK_WIDGET( entry ), pango_font_description_from_string( "Courier New bold 12" ));
   }
}
..........
g_signal_connect( G_OBJECT( renderer ), "editing-started", ( GCallback )cell_edit_font, NULL );

_________________
c/c++ for ever


Last edited by perosoft on Mon Nov 07, 2011 5:38 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: GtkCellRenderer - different font size in edit mode.
PostPosted: Sun Nov 06, 2011 12:47 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hello.

You'll need to modify GtkEntry's font settings from GtkCellRenderer::editing-started signal handler.

Cheers,
Tadej


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group