[Gtk-sharp-list] Editable DataGrid.

Luciano Callero lnc19@hotmail.com
Tue, 14 Oct 2003 15:56:28 -0300


Hi.

I'm trying to write an "Editable Datagrid" control.

It is a class that inherit from ScrolledWindow...
Inside it have a Table Object an in all of this cells it have some Entry and 
other checkButton and other Combo.
I make somethink that simulate databinding. It have a property that is 
datasource, that takes DataTable Object.
It is somethink like this.


class EDataGrid:ScrolledWindow
	{
		Table container;
		DataTable datasource;
		GridColumnsCollection Columns // A custom collection that have columns 
definition
		public EDataGerid()
		{
			//Constructor
		}

		public DataSource
		{
			get
			{
				return datasource;
			}
			set
			{
				datasource = value;
				this.Prepare();
			}
		}

		public Prepare()
		{
			/*
				In this method i create all Columns and define some styles..
			*/
		}

		public ShowData()

		{
			/*
				Here i resize the table (that is the container) and add the 				entry, 
combo or checkButton.
			*/
		}
	}

	// This class is an item for GridRowsColumnsCollection
	class Column
	{
		public GridRowsCollection Rows

	}

	// This is an item for GridRowsCollection
	class Row
	{
		Object contained; // this is the Entry, Combo or checkButton for the 
current row
	}

To do some "real" databinding, i need to set the new value to DataTable 
(datasource) when is changed. This make me add an Event to the Object 
(Combo, Entry or CheckButton). I'm using FocusedOut Event from Widget 
(entry).
My problem is that i dont know how to reference to the Row Object (the 
container row) for the Entry that pass the event.
The only way that i think is to create another class that inherit Entry (in 
case that entry is the choice) that have another property that reference to 
row Index. Is this correct? it is posible to do in other way?

Sorry if you don't understand my pseudo-code i can explain more.

Thanks in advance

kat0

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.yupimsn.com/