[Gtk-sharp-list] Automatically updating via ListStore.RowChanged event? (beginning C#/Gtk# programming)

Jesper K. Pedersen linux at famped.dk
Mon Feb 4 15:47:29 EST 2008


On Mon, 04 Feb 2008 13:44:29 -0500
Adam Tauno Williams <adam at morrison-ind.com> wrote:

> > I am making a small application using Gtk#/C# where I have a
> > collection of data stored in a ListStore.
> 
> Are you adding data to the treeview as values (like strings, etc...)
> or are you mapping the ListStore directly only your objects?
> Ultimately I find doing the later to be simpler as there is nothing
> to sync.
> 

It is just simple updates of text contained in a ListStore through a
TreeView with editable cellrenders. The cellrenders update my data
"mid-end" (my ListStore) just fine.

The data is text from a database source - where I am basically using
the ListStore as a cache on selects and I am trying to get a "write
through" effect on updating data.

>
> > What I am trying to get done is that when the ListStore content
> > change through user input via the GUI a backend datastore will
> > automatically update its data.
> 
> I think you want to fire an event from the TreeView (or contained
> widget), not from the ListStore;  the TreeView needs to notify the
> application data has changed.  I think ListStore.RowChanged notifies
> the widget (or whatever container) that the data has changed in the
> backend and the widget needs to be updated.  But that is off the top
> of my head so I could be wrong.
> 

Trying to stay in the mindset of "object oriented data management" I
would prefer if my data itself can handle the updating of my backend
(in this case a database). Also as my data will at some point be able
to be changed by other parts of my application beside the graphical
front end.


As a sidenote...

I just tried it out with a simple test program without using a TreeView
with a ListStore containing a few fields and then adding my own
RowChanged event handler and that works as I would expect it to. I get a
RowChanged event for every change that happens to my ListStore object.

So it must be the TreeView container who grab the RowChanged event and
stops it from reaching my own eventhandler.

I cant from the manual of Gtk# see if that is an intended effect or not
(it would seem I am "haplessly incompetent" at reading manual pages)

Thank's
  JesperKP


More information about the Gtk-sharp-list mailing list