[Mono-list] Liststore not appending correctly

Luciano _ lnc19 at hotmail.com
Wed Mar 21 17:36:05 EDT 2007


maybe Gtk-sharp list is better place to ask this, but, (i'm not really sure 
about this)
the problem i guess is that Gtk.Application.Invokes, execute in main thread, 
when it can be executed, but not sequentially. Maybe, the Gtk Thread is 
making some Re-paint or something else, and does not work like you want. I'm 
not really sure, i was having this problem (that i descript) and i fix it by 
using Lock (threads).

Bye
Luciano


>From: Nil Gradisnik <ghaefbgtk at gmail.com>
>To: mono-list at lists.ximian.com
>Subject: [Mono-list] Liststore not appending correctly
>Date: Wed, 21 Mar 2007 19:25:31 +0100
>MIME-Version: 1.0
>Received: from lists.ximian.com ([130.57.169.22]) by 
>bay0-mc4-f14.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Wed, 
>21 Mar 2007 11:24:03 -0700
>Received: from galactus.ximian.com (localhost.localdomain [127.0.0.1])by 
>lists.ximian.com (Postfix) with ESMTP id A39861CFBDB;Wed, 21 Mar 2007 
>16:05:54 -0400 (EDT)
>Received: from herald.ximian.com (frontgate.ximian.com [130.57.169.19])by 
>lists.ximian.com (Postfix) with ESMTP id 16D681CFBD5for 
><mono-list at lists.ximian.com>; Wed, 21 Mar 2007 16:05:53 -0400 (EDT)
>Received: by herald.ximian.com (Postfix, from userid 2601)id 4B40F700C2; 
>Wed, 21 Mar 2007 13:23:52 -0500 (EST)
>Received: from mu-out-0910.google.com (mu-out-0910.google.com 
>[209.85.134.186])by herald.ximian.com (Postfix) with ESMTP id E7F7A700C2for 
><mono-list at lists.ximian.com>; Wed, 21 Mar 2007 13:23:48 -0500 (EST)
>Received: by mu-out-0910.google.com with SMTP id i2so589794muefor 
><mono-list at lists.ximian.com>; Wed, 21 Mar 2007 11:23:47 -0700 (PDT)
>Received: by 10.82.146.14 with SMTP id t14mr2212125bud.1174501423296;Wed, 
>21 Mar 2007 11:23:43 -0700 (PDT)
>Received: from ?192.168.1.4? ( [195.210.246.130])by mx.google.com with 
>ESMTP id w5sm7994538mue.2007.03.21.11.23.42;Wed, 21 Mar 2007 11:23:42 -0700 
>(PDT)
>X-Message-Info: 
>txF49lGdW41PiY++DHdEakZftiq+hFZVIZ/MSj+RNwy4Y1T3HH+ONmwdZpr5qsUj
>X-Original-To: mono-list at lists.ximian.com
>Delivered-To: mono-list at lists.ximian.com
>X-Mailer: Evolution 2.8.3 (2.8.3-1.fc6) X-Spam-Checker-Version: 
>SpamAssassin 3.0.3 (2005-04-27) on frontgate.ximian.com
>X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 
>tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS version=3.0.3
>X-BeenThere: mono-list at lists.ximian.com
>X-Mailman-Version: 2.1.8
>Precedence: list
>List-Id: Mono Developer Discussion List <mono-list.lists.ximian.com>
>List-Unsubscribe: 
><http://lists.ximian.com/mailman/listinfo/mono-list>,<mailto:mono-list-request at lists.ximian.com?subject=unsubscribe>
>List-Archive: <http://lists.ximian.com/pipermail/mono-list>
>List-Post: <mailto:mono-list at lists.ximian.com>
>List-Help: <mailto:mono-list-request at lists.ximian.com?subject=help>
>List-Subscribe: 
><http://lists.ximian.com/mailman/listinfo/mono-list>,<mailto:mono-list-request at lists.ximian.com?subject=subscribe>
>Errors-To: mono-list-bounces at lists.ximian.com
>Return-Path: mono-list-bounces at lists.ximian.com
>X-OriginalArrivalTime: 21 Mar 2007 18:24:04.0020 (UTC) 
>FILETIME=[1AD58740:01C76BE6]
>
>I need your opinion on this one. I'm running a Thread which starts this
>function named PopulateTreevew() and in there this is what happens:
>
>//populate treeview
>public void PopulateTreeviewThreadRoutine()
>{
>	Gtk.Application.Invoke (delegate {
>		liststore.Clear();
>	});
>
>	for (int i = 0; i < 10; i++) {
>
>		Console.WriteLine (i); //THIS one works
>		Gtk.Application.Invoke (delegate {
>			Console.WriteLine (i); //THIS one sometimes works
>			liststore.AppendValues (i);
>		});
>	}
>
>	Gtk.Application.Invoke (delegate {
>		Treeview1.Model = liststore;
>	});
>}
>
>My main problem is that I sometimes get all the same(the last) contents
>of my variable array to my Treeview, using liststore.AppendValues... I
>tested this values with Console.WriteLine.
>As you can see I'm using Gtk.Application.Invoke, because I'm running a
>Thread outside the main GTK thread.
>
>So basically I narrowed it down to this, that if I print out those
>variables(arrays) before the Gtk.Application.Invoke, it always prints
>out OK, the numbers(i) are 0,1,2,3,4,5,6...9. But If I print them out
>inside Gtk.Application.Invoke I sometimes(randomly) get just all 9s !
>That is 9,9,9,9,9.......9.
>
>Why is that ? What could cause this problem, I don't understand.
>It looks like a bug in Gtk.Application.Invoke or something.
>
>Can I use something else than Gtk.Application.Invoke, so that I get out
>the correct array?
>Because it looks like the Gtk.Application.Invoke messes up things
>randomly.
>
>
>Please advise
>
>Thanks
>
>
>Nil Gradisnik
>
>_______________________________________________
>Mono-list maillist  -  Mono-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list

_________________________________________________________________
Consigue aquí las mejores y mas recientes ofertas de trabajo EE.UU. 
http://latino.msn.com/empleos



More information about the Mono-list mailing list