Hi: > On Wed, 2008-04-30 at 10:49 +0200, Martin (OpenGeoMap) wrote: > >> Hi all: >> >> It´s posible edit the cellrender for doubles?? >> >> Always put 6 decimals. Can i modify that?? >> >> Any tips appreciated. >> > > You can use gtk_tree_view_column_set_cell_data_func() to change how data > is displayed in your cell renderer. For instance, you can set the "text" > property with the result of a sprintf() call: > http://library.gnome.org/devel/gtk/unstable/GtkTreeViewColumn.html#gtk-tree-view-column-set-cell-data-func > > gtkmm even has a Gtk::TreeView::append_column_numeric() method to make > this easier: > http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeView.html#e6fc0051cc178bfacea2dec27c2d5a58 > > Thank you so much, Murray. In ruby works fine also.
renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new("Prize", renderer,'text' => PRIZE_COLUMN) column.set_cell_data_func(renderer) {|column, cell, model, iter| cell.text=sprintf("%.2f",iter[PRIZE_COLUMN]) } Ruby-gnome Rocks!!!!!!!!!!!!!!!!! Regards. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list