[MonoDevelop] PropertyGrid]

Fresnay Pascal pascalfresnay@free.fr
Thu, 08 Jul 2004 12:46:11 +0200


--=-S1X8QfE7MGKkBRuzJoQK
Content-Type: text/plain
Content-Transfer-Encoding: 7bit



--=-S1X8QfE7MGKkBRuzJoQK
Content-Disposition: inline
Content-Description: Message =?ISO-8859-1?Q?transf=E9r=E9?= - Re:
	[MonoDevelop] PropertyGrid
Content-Type: message/rfc822

Subject: Re: [MonoDevelop] PropertyGrid
From: Fresnay Pascal <pascalfresnay@free.fr>
To: Todd Berman <tberman@off.net>
In-Reply-To: <1089263467.3207.7.camel@localhost.localdomain>
References: <1089231482.21001.3.camel@sud-1-82-67-113-45.fbx.proxad.net>
	 <1089263467.3207.7.camel@localhost.localdomain>
Content-Type: text/plain; charset=utf-8
Message-Id: <1089274721.2873.13.camel@sud-1-82-67-113-45.fbx.proxad.net>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) 
Date: Thu, 08 Jul 2004 10:18:42 +0200
Content-Transfer-Encoding: 8bit

Le jeu 08/07/2004 à 07:11, Todd Berman a écrit :
> On Wed, 2004-07-07 at 22:18 +0200, Fresnay Pascal wrote:
> > Hi,
> > 
> > I'm writing a PropertyGrid in Gtk# that display properties from an
> > object. I think that it could be helpful, especially for a GUI
> > Designer... Is there a similar widget developped in Monodevelop project
> > ?
> 
> How are you writing it? I would be interested in some more info on what
> you are doing exactly.
> 
> --Todd
> 
I use TypeDescriptor and PropertyDescriptor (System.ComponentModel
namespace) to get all properties. Then I add a specific GUI editor for
each properties found (string : Gtk.Label, int : Gtk.SpinButton, etc.)
if type is unknown, I search for an enum interface.
Here is a basic example of use :

public class MyWindow : Window {
	
	public MyWindow () : base ("MyWindow")
	{
		PropertyGrid pg = new PropertyGrid();
		pg.SelectedObject = this;//edit current window
		this.Add(pg);
	}
}

It's possible to add an editor for a specific type at runtime :

PropertyGrid.RegisterEditor(typeof(GdkSizeEditor), typeof(Gdk.Size));

I also use DescriptionAttribute to display tips over different widgets.

here is a overview :
http://pascalfresnay.free.fr/divers/propertyGrid.png



--=-S1X8QfE7MGKkBRuzJoQK--