зеркало из https://github.com/mono/mail-archives.git
151 строка
6.0 KiB
HTML
151 строка
6.0 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE> [Gtk-sharp-list] Losing Data of a TreeView
|
||
|
</TITLE>
|
||
|
<LINK REL="Index" HREF="index.html" >
|
||
|
<LINK REL="made" HREF="mailto:pablo%40pablo.com.mx">
|
||
|
<META NAME="robots" CONTENT="index,nofollow">
|
||
|
|
||
|
<LINK REL="Previous" HREF="002589.html">
|
||
|
<LINK REL="Next" HREF="002591.html">
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#ffffff">
|
||
|
<H1>[Gtk-sharp-list] Losing Data of a TreeView
|
||
|
</H1>
|
||
|
<B>Pablo Fischer
|
||
|
</B>
|
||
|
<A HREF="mailto:pablo%40pablo.com.mx"
|
||
|
TITLE="[Gtk-sharp-list] Losing Data of a TreeView">pablo@pablo.com.mx
|
||
|
</A><BR>
|
||
|
<I>Thu, 16 Oct 2003 09:46:58 -0500</I>
|
||
|
<P><UL>
|
||
|
<LI> Previous message: <A HREF="002589.html">[Gtk-sharp-list] Increesing glade-sharp speed
|
||
|
</A></li>
|
||
|
<LI> Next message: <A HREF="002591.html">[Gtk-sharp-list] Losing Data of a TreeView
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#2582">[ date ]</a>
|
||
|
<a href="thread.html#2582">[ thread ]</a>
|
||
|
<a href="subject.html#2582">[ subject ]</a>
|
||
|
<a href="author.html#2582">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
<HR>
|
||
|
<!--beginarticle-->
|
||
|
<PRE>--=-2DHDkSsJ81JMjvDc3Uar
|
||
|
Content-Type: text/plain
|
||
|
Content-Transfer-Encoding: 7bit
|
||
|
|
||
|
Hi!
|
||
|
|
||
|
Well, I have a TreeView where Im loading the content of a xml file, and
|
||
|
also I have a button where I can add new content (username, password,
|
||
|
bla bla). Every time I add a new entry to the xml file I update the
|
||
|
TreeView and it works it's showing the new entries. But.. If I close
|
||
|
that window (that contains the TreeView) and Open It for second time the
|
||
|
new entries that I added dissapeared!. I also tried to print all the
|
||
|
entries (Console.WriteLine) every time I open the window and the data
|
||
|
continues in the Object (Accounts accounts).
|
||
|
|
||
|
Im pasting at the end of the file the method that Creates that Windows
|
||
|
and the Method that loads the DataAccounts.
|
||
|
|
||
|
Thanks!
|
||
|
Pablo
|
||
|
--
|
||
|
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
|
||
|
<A HREF="http://www.pablo.com.mx">http://www.pablo.com.mx</A>
|
||
|
<A HREF="http://www.debianmexico.org">http://www.debianmexico.org</A>
|
||
|
GPG FingerTip: 3D49 4CB8 8951 F2CA 8131 AF7C D1B9 1FB9 6B11 810C
|
||
|
Firma URL: <A HREF="http://www.pablo.com.mx/firmagpg.txt">http://www.pablo.com.mx/firmagpg.txt</A>
|
||
|
|
||
|
--=-2DHDkSsJ81JMjvDc3Uar
|
||
|
Content-Disposition: attachment; filename=load_data
|
||
|
Content-Type: text/plain; name=load_data; charset=ISO-8859-1
|
||
|
Content-Transfer-Encoding: 7bit
|
||
|
|
||
|
|
||
|
private void LoadDataAccountsTree() {
|
||
|
//Load the config file
|
||
|
// ReadConfig();
|
||
|
//The iterator
|
||
|
TreeIter iter = new TreeIter ();
|
||
|
//The counter
|
||
|
int count = 0;
|
||
|
do {
|
||
|
GLib.Value name = new GLib.Value(((Account)accounts.accountArray[count]).identifier);
|
||
|
GLib.Value website = new GLib.Value(((Account)accounts.accountArray[count]).url);
|
||
|
GLib.Value counter = new GLib.Value (count.ToString());
|
||
|
accounts_treestore.Append (out iter);
|
||
|
accounts_treestore.SetValue (iter, 0, name);
|
||
|
accounts_treestore.SetValue (iter, 1, website);
|
||
|
accounts_treestore.SetValue (iter, 2, counter);
|
||
|
Console.WriteLine("El usuario: {0}", ((Account)accounts.accountArray[count]).username);
|
||
|
count++;
|
||
|
}while(count > accounts.accountArray.Count);
|
||
|
}
|
||
|
|
||
|
--=-2DHDkSsJ81JMjvDc3Uar
|
||
|
Content-Disposition: attachment; filename=load_window
|
||
|
Content-Type: text/plain; name=load_window; charset=ISO-8859-1
|
||
|
Content-Transfer-Encoding: 7bit
|
||
|
|
||
|
private void LoadAccountsWindow() {
|
||
|
Glade.XML ui2 = new Glade.XML(null, "mbloggy.glade","accountsWindow", null);
|
||
|
ui2.Autoconnect(this);
|
||
|
accountsWindow = (Gtk.Window)ui2["accountsWindow"];
|
||
|
//Load the ScrolledWindow
|
||
|
Gtk.ScrolledWindow accounts_scrolledwindow = (Gtk.ScrolledWindow)ui2["accounts_scrolledwindow"];
|
||
|
//Create the treestore
|
||
|
accounts_treestore = new Gtk.TreeStore((int)TypeFundamentals.TypeString,
|
||
|
(int)TypeFundamentals.TypeString,
|
||
|
(int)TypeFundamentals.TypeString);
|
||
|
//Lets load the name of the accounts
|
||
|
accounts_treeview = (Gtk.TreeView)ui2["accounts_treeview"];
|
||
|
accounts_treeview.Model = accounts_treestore;
|
||
|
accounts_treeview.HeadersVisible = true;
|
||
|
accounts_treeview.Reorderable = true;
|
||
|
accounts_treeview.RulesHint = true;
|
||
|
//We are going to use a render to show the columns, so lets create it
|
||
|
render = new Gtk.CellRendererText();
|
||
|
//The columns
|
||
|
Gtk.TreeViewColumn col_identifier = new Gtk.TreeViewColumn();
|
||
|
col_identifier.Title = "Name"; col_identifier.Resizable = true;
|
||
|
col_identifier.Reorderable = false; col_identifier.PackStart(render, false);
|
||
|
col_identifier.AddAttribute(render, "text", 0); accounts_treeview.AppendColumn(col_identifier);
|
||
|
//The second column (the url)
|
||
|
Gtk.TreeViewColumn col_url = new Gtk.TreeViewColumn();
|
||
|
col_url.Title = "Website"; col_url.Resizable = true;
|
||
|
col_url.Reorderable = false; col_url.PackStart(render, false);
|
||
|
col_url.AddAttribute(render, "text", 1); accounts_treeview.AppendColumn(col_url);
|
||
|
//The third column (an in identifier to load faster the config file)
|
||
|
Gtk.TreeViewColumn col_num = new Gtk.TreeViewColumn();
|
||
|
col_num.Title = "Website"; col_num.Resizable = true; col_num.Visible = false;
|
||
|
col_num.Reorderable = false; col_num.PackStart(render, false);
|
||
|
col_num.AddAttribute(render, "text", 2); accounts_treeview.AppendColumn(col_num);
|
||
|
//Load the data
|
||
|
LoadDataAccountsTree();
|
||
|
}
|
||
|
|
||
|
--=-2DHDkSsJ81JMjvDc3Uar--
|
||
|
|
||
|
|
||
|
</PRE>
|
||
|
<!--endarticle-->
|
||
|
<HR>
|
||
|
<P><UL>
|
||
|
<!--threads-->
|
||
|
<LI> Previous message: <A HREF="002589.html">[Gtk-sharp-list] Increesing glade-sharp speed
|
||
|
</A></li>
|
||
|
<LI> Next message: <A HREF="002591.html">[Gtk-sharp-list] Losing Data of a TreeView
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#2582">[ date ]</a>
|
||
|
<a href="thread.html#2582">[ thread ]</a>
|
||
|
<a href="subject.html#2582">[ subject ]</a>
|
||
|
<a href="author.html#2582">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
</body></html>
|