[Re: [Gtk-sharp-list] win32 vs linux override discrepancy]

Alvaro A. Ramirez alramire@ecs.syr.edu
Thu, 04 Mar 2004 14:09:50 -0500


--=-wxlGPFTd6c3iXh+Bjg7L
Content-Type: text/plain
Content-Transfer-Encoding: 7bit



--=-wxlGPFTd6c3iXh+Bjg7L
Content-Disposition: inline
Content-Description: Forwarded message - Re: [Gtk-sharp-list] win32 vs
	linux override discrepancy
Content-Type: message/rfc822

Subject: Re: [Gtk-sharp-list] win32 vs linux override discrepancy
From: "Alvaro A. Ramirez" <alramire@ecs.syr.edu>
To: will@xpi.net
In-Reply-To: <3733.216.17.234.6.1078353539.squirrel@pop.xpi.net>
References: <1078345020.10090.27.camel@stella>
	 <3733.216.17.234.6.1078353539.squirrel@pop.xpi.net>
Content-Type: multipart/mixed; boundary="=-pJK+KDHN8g6PDZWEA9eb"
Message-Id: <1078427259.2540.7.camel@stella>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 
Date: Thu, 04 Mar 2004 14:07:39 -0500


--=-pJK+KDHN8g6PDZWEA9eb
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Will,

thank you. everything worked perfectly both on win32 and linux. if
anyone needs to catch right-click events on a treeview, here's how i did
it in an attachment.

regards, 

alvaro

 




On Wed, 2004-03-03 at 17:38, will@xpi.net wrote:
> I have put the latest CVS WIN32 builds in an installer at
> http://pop.xpi.net/gtksharp/gtksharp.exe .
> 
> This installer is similar to the .15 installer I made a while back but is
> using the latest CVS build.
> 
> Works for VS .NET/C# Builder.
> 
> By request, I have changed the install dir to C:\Program
> Files\GNU\LIB\GTKSHARP .   But you can actually install the libraries
> anywhere you want to (I prefer C:\GNU\LIB\GTKSHARP). If you are using my
> previous installer, unistall it using the Add/Remove link and then install
> this new one.
> 
> Don't forget to update your references in VS .NET to the new install dir.
> 
> Also this version of the Installer has one annoying bug in it that I
> haven't had the time to correct:
> 
> If you decide to uninstall GTKSHARP, it will remove the entry in the
> Add/Remove Programs tool in the Control Panel.  However, it does not
> correctly remove the shortcut in the Windows Start Menu.  Just right-click
> on it and delete it.
> 
> I will get around to fixing that annoying bug when I have the time.
> 
> Also for you extremely lazy people out there (count me in this group):
> 
> I have a new Windows installer that is currently in testing with my QA
> guy.  It is fully aware of Mono, MCS, VS .NET and C# Builder.  So it will
> let you choose which compiler to install for.  It also will grab the
> latest daily CVS builds of GTKSharp from our servers so that I don't have
> to keep recompiling the installer for new people.  Then there is an
> auto-update tool that will check daily for new builds of the gtksharp
> libraries and download an incrimental (spelling?) patch for the files from
> the servers.  On the server end, it builds the latest cvs builds
> automatically and makes them available for the auto-update tool in the
> installer.
> 
> The thought was to take the headache out of using the GTKSHARP libraries
> and let people focus on just developing.
> 
> When the newer installer is available, I will let everyone know.
> 
> Enjoy!
> 
> --Will Collins
>   Xperience Software
>   will@xpi.net
> 
> > I've been using gtk# on linux (mono) and win32 (.net). This has been
> > working flawlessly for quite a while. Now that I upgraded gtk# on linux
> > to 0.17, the same code does not compile on .net. I decided to compile my
> > 0.17 dll's using cygwin (for the first time). Not sure if I'm doing it
> > right. Took the 7 compiled dll's and put them in my Bin/Debug directory
> > of my visual studio solution. This is where I usually put them when I
> > download them from the gtk# site and they work.
> >
> > Assuming that I compiled them correctly, I cannot override
> > OnButtonPressEvent on win32 (.net). On linux it's ok.
> >
> > I get "no suitable method found to override."
> >
> > I'm using:
> >
> > protected override bool OnButtonPressEvent(Gdk.EventButton evnt)
> >
> > In order for it to work on .net, I have to use ref:
> >
> > protected override bool OnButtonPressEvent(ref Gdk.EventButton evnt)
> >
> >
> > Also, members of Gdk.EventButton are lower case in win32 and uppercase
> > on mono (linux) such as:
> >
> > button, x, and y
> >
> > Does anyone have the windows dll's for 0.17? I would like to try someone
> > else's?
> >
> > Regards,
> >
> > Alvaro
> >
> > _______________________________________________
> > Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> >
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 

--=-pJK+KDHN8g6PDZWEA9eb
Content-Disposition: attachment; filename=override.cs
Content-Type: text/x-csharp; name=override.cs; charset=iso-8859-1
Content-Transfer-Encoding: 7bit


namespace GtkSamples {

	using Gtk;
	using System;

	public class ButtonApp  {

		public static int Main (string[] args)
		{
			Application.Init ();
			Window win = new Window ("Treeview Tester");
			win.DeleteEvent += new DeleteEventHandler (Quit);
			EasyTreeview SubbedTree = new EasyTreeview("hello","bye","hola","adios");
			SubbedTree.ExtendedButtonPressedEvent+=new EasyTreeview.ExtendedButtonPressedHandler(ObjectPopup);
			SubbedTree.AddRow("yes","no","si","no");
			SubbedTree.AddRow("yes","no","si","no");
			SubbedTree.AddRow("yes","no","si","no");
			win.Add (SubbedTree);
			win.ShowAll ();
			Application.Run ();
			return 0;
		}

		static void ObjectPopup(object o, Gdk.EventButton e)
		{
			EasyTreeview TempEasyTreeView = (EasyTreeview)o;
         
			if (e.Button==3)
			{
				Gtk.TreePath TempPath = new Gtk.TreePath();
				if (TempEasyTreeView.GetPathAtPos((int)e.X,(int)e.Y,out TempPath))
				Console.WriteLine("right clicked node "+TempPath.ToString());
			}
		}

		static void Quit (object sender, DeleteEventArgs args)
		{
			Application.Quit();
		}
	}



public class EasyTreeview:Gtk.TreeView
	{
		private Gtk.ListStore ListStoreTemp;
        	private static  GLib.GType TreeType;
		
        	public delegate void ExtendedButtonPressedHandler( object o, Gdk.EventButton e );        
        	public event ExtendedButtonPressedHandler ExtendedButtonPressedEvent;
        
		static EasyTreeview()
		{
			TreeType=RegisterGType(typeof(EasyTreeview));
		}

		public EasyTreeview(params string[] StringColumnsPar):base(TreeType)
		{
			this.ListStoreTemp = null;
			System.Type[] RowTypes = null;
			RowTypes = new System.Type[StringColumnsPar.Length];
			
			for (int i = 0; i<StringColumnsPar.Length; i++)
				RowTypes[i]=typeof(string);
			this.ListStoreTemp=new Gtk.ListStore(RowTypes);
			this.Model=ListStoreTemp;
			Gtk.TreeViewColumn[] ColumnArray = new Gtk.TreeViewColumn[StringColumnsPar.Length];
			int IntCounter=0;
			
			foreach (string StringTemp in StringColumnsPar)
			{
			ColumnArray[IntCounter]=this.AppendColumn(StringTemp,new Gtk.CellRendererText(),"text",IntCounter);
			ColumnArray[IntCounter].SortColumnId=IntCounter;
			IntCounter++;
			}

			this.HeadersVisible=true;
		}

        	protected override bool OnButtonPressEvent(Gdk.EventButton evnt)        
        	{
            		bool BaseResult=base.OnButtonPressEvent (evnt);                
            		if( ExtendedButtonPressedEvent != null ) 
                	{                    
                    		ExtendedButtonPressedEvent( this, evnt );                
                	}                
            		return BaseResult;        
        	}
		

		
    		public void AddRow(params string[] StringValuesPar)
		{
			this.ListStoreTemp.AppendValues(StringValuesPar);
		}

  }
}

--=-pJK+KDHN8g6PDZWEA9eb--


--=-wxlGPFTd6c3iXh+Bjg7L--