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

Scott Ellington scottellington at comcast.net
Wed Nov 30 12:26:58 EST 2005


You can call NodeView.QueueDraw to force a redraw of the widget.  I
tried it in your code and it works.  

Scott

On Wed, 2005-11-30 at 17:51 +0000, Archie Maskill wrote:
> 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!";
> 	}
>  }
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-- 
Scott Ellington <scottellington at comcast.net>



More information about the Gtk-sharp-list mailing list