[Mono-list] procedures causing app to exit

rkamarowski rkamarowski at yahoo.com
Fri Nov 26 13:02:01 EST 2010


when the user presses a button, i'm calling a dialogbox which has treeview
attached.  whenever i call a procedure the application exits with no errors:

using Gtk;
using System;
using System.Windows.Forms;

namespace rakPhotography
{
	public partial class DialogTypeOfPrintEdit : Dialog
	{
		public class typeOfPrint
		{
			public typeOfPrint(string name, string active)
			{
				this.Name = name;
				this.Active = active;
			}
			public string Name;
			public string Active;
		}
		
		private ListStore store;
		
		protected virtual void OnButtonCancelClicked (object sender,
System.EventArgs e)
		{
			Destroy();
		}
		
		public DialogTypeOfPrintEdit ()
		{
			this.Build ();
			// list store
			store = new ListStore(typeof (string), typeof (string));
			// columns
			TreeViewColumn colName = new TreeViewColumn();
			TreeViewColumn colActive = new TreeViewColumn();
			// titles
			colName.Title = "Type of Print";
			colActive.Title = "Active";
			// column widths
			colName.MinWidth = 300;
			colName.Resizable = true;
			colActive.Alignment.Equals(0.5);
			colActive.MinWidth = 30;
			colActive.MaxWidth = 40;
			// cell renderers
			CellRendererText nameRenderer = new CellRendererText();
			CellRendererToggle activeRenderer = new CellRendererToggle();
			nameRenderer.Editable = true;
			activeRenderer.Activatable = true;
			activeRenderer.Toggled += new ToggledHandler(activeToggle);
			activeRenderer.Active = true;
			// add renderer to column
			colName.PackStart(nameRenderer,true);
			colActive.PackStart(activeRenderer,true);
			// column number
			colName.AddAttribute(nameRenderer,"text",0);
			colActive.SetCellDataFunc(activeRenderer, new
TreeCellDataFunc(renderActive));// .AddAttribute(activeRenderer,"active",1);
			// add columns to treeview
			treeviewTypeOfPrint.AppendColumn(colName);
			treeviewTypeOfPrint.AppendColumn(colActive);
			// values
			store.AppendValues("Cyanotype",0);
			store.AppendValues("Ziatype",1);
			
			treeviewTypeOfPrint.Model = store;
			treeviewTypeOfPrint.Show();
			
		}
		
		private void activeToggle(object o,ToggledArgs args)
		{
			TreeIter iter;
			//MessageBox.Show("hi");
			if (store.GetIterFromString(out iter, args.Path)) 
			{
				bool val = (bool) store.GetValue(iter,1);
				store.SetValue(iter,1,!val);
				
			}
			    
		}
		
		private void renderActive(TreeViewColumn column, CellRenderer cell,
TreeModel model, TreeIter iter)
		{
			typeOfPrint p = (typeOfPrint) model.GetValue(iter,1);
			if(p.Active.Equals("1")== true)
			{
			}
			//MessageBox.Show(p.Name);
		}
	}
	
}

any help would be appreciated.

bob k.
-- 
View this message in context: http://mono.1490590.n4.nabble.com/procedures-causing-app-to-exit-tp3060674p3060674.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list