Re: number of digit in gtk_list/gtk_tree ?



On Tue, 2003-04-08 at 21:44, Edward-Liu wrote:
> I use  G_TYPE_FLOAT  in gtk_list/gtk_tree.   How can I set the number of 
> digits/decimal to be displayed in the
> cellview.
> 
> For example,
> 
> 102.099998 should be display as 102.1 in the cellview.

Generally, for custom formatting, it's easiest to use:

void
gtk_tree_view_column_set_cell_data_func (GtkTreeViewColumn   *tree_column,
                                         GtkCellRenderer     *cell_renderer,
                                         GtkTreeCellDataFunc  func,
                                         gpointer             func_data,
                                         GtkDestroyNotify     destroy)

With this function, you can retrieve the values from your model,
format them with g_strdup_printf() and set them on the renderer
itself.

You could also just have another column in the model with the number
preformatted as a string.

Regards,
                                              Owen





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