[Gtk-sharp-list] Help with CellRenderSpin

alanb alan.battersby at ntlworld.com
Wed Jul 29 15:47:55 EDT 2009

I have a treeview with two columns. I want the  second column to use a
spinbutton to edit and  display a float phase value between 0 and 360.
Nothing is displayed in this column until I select a row and click on the
column to initiate editing, then I see the spinbutton. However I want to see
the spinbutton value when not editing and the spinbutton only when editing.
Can someone tell me how to do this or at least have the spin visible at all


The code I am using is

       Gtk.TreeViewColumn col2 = new Gtk.TreeViewColumn ();
	col2.Title = "Phase";
	Gtk.CellRendererSpin col2Cell = new Gtk.CellRendererSpin();
	col2Cell.Digits = 3;
	Adjustment adj = new Adjustment(0,0,360,0.1,10,10);	
	col2Cell.Adjustment = adj;
	col2Cell.Editable = true;
	col2Cell.Visible = true;
	col2Cell.Sensitive = true;
	col2.PackStart (col2Cell, true);
	col2.SetCellDataFunc (col2Cell, new Gtk.TreeCellDataFunc (RenderCol2));

private void RenderCol2 (Gtk.TreeViewColumn column, Gtk.CellRenderer cell,
Gtk.TreeModel model, Gtk.TreeIter iter)
	PhaseElement rp = (PhaseElement) model.GetValue (iter, 0);
	(cell as Gtk.CellRendererSpin).Adjustment.Value = rp.Phase;

View this message in context: http://www.nabble.com/Help-with-CellRenderSpin-tp24726282p24726282.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

More information about the Gtk-sharp-list mailing list