[Gtk-sharp-list] NodeView row refreshes only when there's mouse activity

Archie Maskill galepsus at gmail.com
Wed Nov 30 12:51:49 EST 2005


Hey everyone -

I have a NodeView, populated with some nodes.  A value in one of the
nodes is changed, but this change is not reflected visually until I
move the mouse into (or out of) the offending row.  Moving the mouse
strictly within the offending row has no effect.

The closest thing I've found to someone mentioning this problem is in
this thread : http://lists.ximian.com/pipermail/gtk-sharp-list/2004-November/005099.html

I'm doing much the same thing that this chap describes, and making
sure to use ThreadNotify sensibly.  It seems it was accepted that the
problem was a multiple-thread-related one, but I've managed to
reproduce it using a very simple single-thread example.  I've reduced
this to the simplest possible situation and included it below.

This happens on both Windows 2000 and Linux.

Is this a bug?  Or is it done for reasons of efficiency, and I'm
supposed to call some kind of refresh method once I've made a change
to a node's value?  What do other people do to get round this?

Thanks in advance!
- Archie


using Gtk;
using System;

public class MyTreeNode : Gtk.TreeNode
{
	[Gtk.TreeNodeValue (Column=0)]
	public string variable;
	
	public MyTreeNode (string var)
	{
		variable = var;
	}
}

public class MainClass
{
	static MyTreeNode node_to_change;
	
	public static void Main()
	{
		Application.Init();
		Window w = new Window("Window Title");
		VBox v0 = new VBox();
		w.Add(v0);
		
		NodeStore store = new NodeStore( typeof(MyTreeNode) );
		node_to_change = new MyTreeNode("Click button then point at this");
		store.AddNode( node_to_change );
		
		NodeView view = new NodeView( store );
		view.AppendColumn("Column header", new CellRendererText(), "text", 0);
		
		Button button = new Button("button");
		button.Clicked += new EventHandler( clickHandler );
		
		v0.Add(view);
		v0.Add(button);
		
		w.ShowAll();
		Application.Run();
	}
	
	public static void clickHandler( object sender, EventArgs args)
	{
		((MyTreeNode)node_to_change).variable = "Changed!";
	}
 }


More information about the Gtk-sharp-list mailing list