Re: Float formatting in TreeView



On Mon, 2009-11-16 at 11:56 -0200, Paulo Flabiano Smorigo wrote:
> Hi Everybody,
> 
> How do I format a float column in a TreeView? The column appears with
> six columns for decimals, like "11.330000". I just want two columns
> for decimals, like "11.33".

You could use append_column_numeric() instead of append_column().
http://library.gnome.org/devel/gtkmm/unstable/classGtk_1_1TreeView.html#ae6fc0051cc178bfacea2dec27c2d5a58

These are both convenience methods. If neither is enough, you can
instead specify the cell renderer details explicitly:
http://library.gnome.org/devel/gtkmm-tutorial/unstable/sec-treeview.html.en#treeview-cellrenderer-details

By using set_cell_data_func() you can create a string representation for
our numeric value:
http://library.gnome.org/devel/gtkmm/unstable/classGtk_1_1TreeViewColumn.html#a765296845c9e9757ba405becbbc13d96



-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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