[Gtk-sharp-list] Gtk: TreeView and gtk-x11-2.0.dll

Andreas Weiss sicherheitstraining@gmx.ch
Sun, 1 Jun 2003 16:43:23 +0200 (MEST)


Hi List,

my little program with a treeview throws an exception on that point where I
try to append some data to a Treestore.

	...
	store = new Gtk.TreeStore((int)TypeFundamentals.TypeString);
	TreeIter iter = new TreeIter ();
	store.Append(out iter);	//<- Here comes the exception.



Unhandled Exception: System.DllNotFoundException: Unable to load DLL
(gtk-x11-2.0).
   at Gtk.TreeStore.gtk_tree_store_append(IntPtr raw, TreeIter& iter, IntPtr
par
ent)
   at Gtk.TreeStore.Append(TreeIter& iter)
   at GladeTest.on_open2_activate(Object obj, EventArgs e)
   at GtkSharp.voidObjectSignal.voidObjectCallback(IntPtr arg0, Int32 key)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at GladeTest..ctor(String[] args)
   at GladeTest.Main(String[] args)


I don't have that gtk-x11-2.0.dll on my Win 2003 Srv with mono-023 and
Gtk-2.0.

Regards,
Andreas





--- code ---

using Gtk;
using GtkSharp;
using Glade;
using GLib;			
using System;
using System.IO;


public class GladeTest{
	//Gtk.Window window1;
	Gtk.Statusbar statusbar1;
	Gtk.Statusbar statusbar2;
	Gtk.Entry entry1;
	Gtk.Entry entry2;
	Gtk.Entry entry3;
	Gtk.Entry entry4;
	private static Gtk.TreeStore store;
	Gtk.TreeView treeview1;
	Gtk.TreeView treeview2;
	
	Glade.XML gxml;
	public static void Main(string[]args)
	{
		new GladeTest(args);
	}

public GladeTest(string[]args)
{
	Application.Init();
	gxml = new Glade.XML("gtk2.glade","window1",null);
	gxml.Autoconnect(this);
// Was bedeutet die unterschiedliche Art der Instanzierung???	
	statusbar1 = gxml.GetWidget("statusbar1") as Gtk.Statusbar;
	statusbar2 = gxml.GetWidget("statusbar2") as Gtk.Statusbar;
	entry1 = gxml.GetWidget("entry1") as Gtk.Entry;
	entry2 = gxml.GetWidget("entry2") as Gtk.Entry;
	entry3 = gxml.GetWidget("entry3") as Gtk.Entry;
	entry4 = gxml.GetWidget("entry4") as Gtk.Entry;
	treeview1 = gxml.GetWidget("treeview1") as Gtk.TreeView;
	treeview2 = gxml.GetWidget("treeview2") as Gtk.TreeView;
//	Gtk.Entry entry1 = (Gtk.Entry)gxml["entry1"];
//	Gtk.Entry entry2 = (Gtk.Entry)gxml["entry2"];
//	Gtk.Entry entry3 = (Gtk.Entry)gxml["entry3"];
//	Gtk.Entry entry4 = (Gtk.Entry)gxml["entry4"];
	Gtk.Window window1 = (Gtk.Window)gxml["window1"];
	window1.Title = "DM-Tool developed by";
	Application.Run();
}

public void on_window1_delete_event(object obj, DeleteEventArgs args)
{
	Application.Quit ();
	System.Environment.Exit (0);
}

public void on_quit1_activate(System.Object obj, EventArgs e)
{
	Application.Quit ();
	System.Environment.Exit (0);
}

public void on_about1_activate(System.Object obj, EventArgs e)
{
	
}

public void on_open1_activate(System.Object obj, EventArgs e)
{
	FileOpen();
}

public void on_open2_activate(System.Object obj, EventArgs e)
{
	store = new Gtk.TreeStore((int)TypeFundamentals.TypeString);
	TreeIter iter = new TreeIter ();
	store.Append(out iter);
	//store.SetValue(iter,0,new GLib.Value("-myString-"));
	
	
	
	treeview1.Model = store;
	
	Gtk.TreeViewColumn treeview1column1 = new TreeViewColumn();
	Gtk.CellRenderer treeview1column1Renderer = new CellRendererText();
	treeview1column1.Title = "Tagname";
	treeview1column1.PackStart(treeview1column1Renderer, true);
	treeview1column1.AddAttribute(treeview1column1Renderer, "text", 0);
	
	treeview1.AppendColumn(treeview1column1);
//	store = new TreeStore
((int)TypeFundamentals.TypeString,(int)TypeFundamentals.TypeString);
//	store.Append (out iter, parent);
//	store.SetValue (iter, 0, Name);


//
//	TreeView treeview1 = new TreeView (store);
//	treeview1.HeadersVisible = true;
//
//	TreeViewColumn NameCol = new TreeViewColumn ();
//	CellRenderer NameRenderer = new CellRendererText ();
//	NameCol.Title = "Name";
//	NameCol.PackStart (NameRenderer, true);
//	NameCol.AddAttribute (NameRenderer, "text", 0);
//	treeview1.AppendColumn (NameCol);

}



public void FileOpen()
{
	string strPathFile = "";
	string strFile = "";
	//if (Path.DirectorySeparatorChar.ToString() == "\")
	strPathFile = entry1.Text;
	
	//Ueberpruefung, auf gueltige Pfad-Angabe
	if (strPathFile.Length > 3)
	{
		FileInfo FileInfo1 = new FileInfo(strPathFile);
		if (FileInfo1.Exists)
		{ 
			statusbar1.Push(0, FileInfo1.Name);
			try
			{
			FileStream FileStream1 = new FileStream(strPathFile,
System.IO.FileMode.Open, System.IO.FileAccess.Read);
			StreamReader StreamReader1 = new StreamReader(FileStream1);
			strFile = StreamReader1.ReadToEnd();
			StreamReader1.Close();
			FileStream1.Close();
			}
			catch (Exception e1)
			{
				statusbar1.Push(0, "errors encounterd during file handling");
				Console.WriteLine("Error: " + e1.Message + " ; on_open1_activate: file
handling");
			}
			try
			{

			}
			catch (Exception e2)
			{
				statusbar1.Push(0, "error encounterd during string manipulation");
				Console.WriteLine("Error: " + e2.Message + " ; on_open1_activate: string
manipulation");
			}
		}
		else
		{
			statusbar1.Push(0, "file doesn't exists");
		}	//if (FileInfo1.Exists)
	}
	else
		{
			statusbar1.Push(0, "Please provide a valid file name");
		}	//if (strPathFile.Length > 3)
		
}	//public void FileOpen()




}


---
csc -r:gtk-sharp.dll -r:gdk-sharp.dll -r:glib-sharp.dll -r:atk-sharp.dll
-r:glade-sharp.dll  DM-Tool1.cs

---

gtk2.glade

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title" translatable="yes">window1</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="default_width">640</property>
  <property name="default_height">480</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <signal name="delete_event" handler="on_window1_delete_event"
last_modification_time="Sun, 01 Jun 2003 14:08:51 GMT"/>

  <child>
    <widget class="GtkTable" id="table1">
      <property name="visible">True</property>
      <property name="n_rows">6</property>
      <property name="n_columns">3</property>
      <property name="homogeneous">False</property>
      <property name="row_spacing">0</property>
      <property name="column_spacing">0</property>

      <child>
	<widget class="GtkMenuBar" id="menubar1">
	  <property name="visible">True</property>

	  <child>
	    <widget class="GtkMenuItem" id="menuitem1">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">_File</property>
	      <property name="use_underline">True</property>

	      <child>
		<widget class="GtkMenu" id="menuitem1_menu">

		  <child>
		    <widget class="GtkMenuItem" id="open1">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">Open1</property>
		      <property name="use_underline">True</property>
		      <signal name="activate" handler="on_open1_activate"
last_modification_time="Sun, 01 Jun 2003 13:13:59 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkMenuItem" id="open2">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">Open2</property>
		      <property name="use_underline">True</property>
		      <signal name="activate" handler="on_open2_activate"
last_modification_time="Sun, 01 Jun 2003 13:17:21 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkMenuItem" id="separatormenuitem1">
		      <property name="visible">True</property>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="quit1">
		      <property name="visible">True</property>
		      <property name="label">gtk-quit</property>
		      <property name="use_stock">True</property>
		      <signal name="activate" handler="on_quit1_activate"
last_modification_time="Sun, 01 Jun 2003 13:13:59 GMT"/>
		    </widget>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkMenuItem" id="menuitem4">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">_Help</property>
	      <property name="use_underline">True</property>

	      <child>
		<widget class="GtkMenu" id="menuitem4_menu">

		  <child>
		    <widget class="GtkMenuItem" id="about1">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">_About</property>
		      <property name="use_underline">True</property>
		      <signal name="activate" handler="on_about1_activate"
last_modification_time="Sun, 01 Jun 2003 13:13:59 GMT"/>
		    </widget>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>
	</widget>
	<packing>
	  <property name="left_attach">0</property>
	  <property name="right_attach">1</property>
	  <property name="top_attach">0</property>
	  <property name="bottom_attach">1</property>
	  <property name="x_options">fill</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkScrolledWindow" id="scrolledwindow1">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
	  <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
	  <property name="shadow_type">GTK_SHADOW_NONE</property>
	  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>

	  <child>
	    <widget class="GtkTreeView" id="treeview1">
	      <property name="visible">True</property>
	      <property name="can_focus">True</property>
	      <property name="headers_visible">True</property>
	      <property name="rules_hint">False</property>
	      <property name="reorderable">False</property>
	      <property name="enable_search">True</property>
	    </widget>
	  </child>
	</widget>
	<packing>
	  <property name="left_attach">1</property>
	  <property name="right_attach">2</property>
	  <property name="top_attach">2</property>
	  <property name="bottom_attach">3</property>
	</packing>
      </child>

      <child>
	<widget class="GtkScrolledWindow" id="scrolledwindow2">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
	  <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
	  <property name="shadow_type">GTK_SHADOW_NONE</property>
	  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>

	  <child>
	    <widget class="GtkTreeView" id="treeview2">
	      <property name="visible">True</property>
	      <property name="can_focus">True</property>
	      <property name="headers_visible">True</property>
	      <property name="rules_hint">False</property>
	      <property name="reorderable">False</property>
	      <property name="enable_search">True</property>
	    </widget>
	  </child>
	</widget>
	<packing>
	  <property name="left_attach">2</property>
	  <property name="right_attach">3</property>
	  <property name="top_attach">2</property>
	  <property name="bottom_attach">3</property>
	  <property name="y_options">fill</property>
	</packing>
      </child>

      <child>
	<widget class="GtkEntry" id="entry1">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="editable">True</property>
	  <property name="visibility">True</property>
	  <property name="max_length">0</property>
	  <property name="text" translatable="yes">C:\Documents and
Settings\Administrator\My Documents\Projekte\mono\dm-tool1.txt</property>
	  <property name="has_frame">True</property>
	  <property name="invisible_char" translatable="yes">*</property>
	  <property name="activates_default">False</property>
	</widget>
	<packing>
	  <property name="left_attach">1</property>
	  <property name="right_attach">2</property>
	  <property name="top_attach">1</property>
	  <property name="bottom_attach">2</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkEntry" id="entry2">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="editable">True</property>
	  <property name="visibility">True</property>
	  <property name="max_length">0</property>
	  <property name="text" translatable="yes"></property>
	  <property name="has_frame">True</property>
	  <property name="invisible_char" translatable="yes">*</property>
	  <property name="activates_default">False</property>
	</widget>
	<packing>
	  <property name="left_attach">2</property>
	  <property name="right_attach">3</property>
	  <property name="top_attach">1</property>
	  <property name="bottom_attach">2</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkStatusbar" id="statusbar1">
	  <property name="visible">True</property>
	  <property name="has_resize_grip">True</property>
	</widget>
	<packing>
	  <property name="left_attach">1</property>
	  <property name="right_attach">2</property>
	  <property name="top_attach">5</property>
	  <property name="bottom_attach">6</property>
	  <property name="x_options">fill</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkEntry" id="entry3">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="editable">True</property>
	  <property name="visibility">True</property>
	  <property name="max_length">0</property>
	  <property name="text" translatable="yes"></property>
	  <property name="has_frame">True</property>
	  <property name="invisible_char" translatable="yes">*</property>
	  <property name="activates_default">False</property>
	</widget>
	<packing>
	  <property name="left_attach">1</property>
	  <property name="right_attach">2</property>
	  <property name="top_attach">3</property>
	  <property name="bottom_attach">4</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkEntry" id="entry4">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="editable">True</property>
	  <property name="visibility">True</property>
	  <property name="max_length">0</property>
	  <property name="text" translatable="yes"></property>
	  <property name="has_frame">True</property>
	  <property name="invisible_char" translatable="yes">*</property>
	  <property name="activates_default">False</property>
	</widget>
	<packing>
	  <property name="left_attach">2</property>
	  <property name="right_attach">3</property>
	  <property name="top_attach">3</property>
	  <property name="bottom_attach">4</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkStatusbar" id="statusbar2">
	  <property name="visible">True</property>
	  <property name="has_resize_grip">True</property>
	</widget>
	<packing>
	  <property name="left_attach">2</property>
	  <property name="right_attach">3</property>
	  <property name="top_attach">5</property>
	  <property name="bottom_attach">6</property>
	  <property name="x_options">fill</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkButton" id="button1">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="label" translatable="yes">button1</property>
	  <property name="use_underline">True</property>
	  <property name="relief">GTK_RELIEF_NORMAL</property>
	</widget>
	<packing>
	  <property name="left_attach">1</property>
	  <property name="right_attach">2</property>
	  <property name="top_attach">4</property>
	  <property name="bottom_attach">5</property>
	  <property name="x_options">fill</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkButton" id="button2">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="label" translatable="yes">button2</property>
	  <property name="use_underline">True</property>
	  <property name="relief">GTK_RELIEF_NORMAL</property>
	</widget>
	<packing>
	  <property name="left_attach">2</property>
	  <property name="right_attach">3</property>
	  <property name="top_attach">4</property>
	  <property name="bottom_attach">5</property>
	  <property name="x_options">fill</property>
	  <property name="y_options"></property>
	</packing>
      </child>

      <child>
	<widget class="GtkButton" id="button3">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="label" translatable="yes">button3</property>
	  <property name="use_underline">True</property>
	  <property name="relief">GTK_RELIEF_NORMAL</property>
	</widget>
	<packing>
	  <property name="left_attach">0</property>
	  <property name="right_attach">1</property>
	  <property name="top_attach">2</property>
	  <property name="bottom_attach">3</property>
	  <property name="x_options">fill</property>
	  <property name="y_options"></property>
	</packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>


-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!