[gtkada] more control when displaying numeric values by a Gtk_Cell_Renderer_Text

Rob Groen robgr at xs4all.nl
Mon Aug 17 15:41:45 CEST 2015


Hello,

I have Gtk_List_Store with 1 column of Gtype_Double. In the 
corresponding Gtk_Tree_View I have a Gtk_Tree_Column with a 
Gtk_Cell_Renderer_Text (the renderer has attribute "text" added) to show 
the data. Now the data is shown in standard formatting, something like 
1234.56789. But I want the data to be shown with 2 decimal places.
What I don't want to do is to add an extra column to the store (of type 
Gtype_String) and have the values stored there as strings.

At first, Gtk_Tree_Cell_Data_Func seems an obvious choice, but the only 
thing you can do is add attributes to the renderer or change its 
properties. And there is no attribute/property that defines how to 
display Gtype_Doubles.

How can I achieve more control on how numeric values are displayed by a 
Gtk_Cell_Renderer_Text?

Regards,
Rob Groen


More information about the gtkada mailing list