View previous topic :: View next topic |
Author |
Message |
jmaeding
Joined: 11 Apr 2008 Posts: 67
|
Posted: Thu Apr 02, 2015 9:55 pm Post subject: last event after an edit |
|
|
I am using programmatic binding and a generic list of objects, and the last method that runs when a cell is edited is SetValueForCell.
If you have that return false it cancels the edit, otherwise you return:
return base.SetValueForCell(row, column, oldValue, val);
The test project we did a few weeks ago had this.
When SetValueForCell runs, it has not changed the object yet, and my goal is to serialize and save the underlying list to file after every change.
Is there a vtree event after the object has changed that I can place my SaveList call in?
Or must I use a bindinglist to watch the list for changes myself, and save then? Would I use the Infralution.common bindinglist, or system.component? _________________ James M |
|
Back to top |
|
|
jmaeding
Joined: 11 Apr 2008 Posts: 67
|
Posted: Thu Apr 02, 2015 11:52 pm Post subject: |
|
|
it looks like one way is to use the GetCellData method.
It will run once when filling in a cell, and once also after an edit.
If I set a flag like "EditPerformed", and switch it to true in the SetValueForCell method, which runs when the editor is changing a property, I can run something after a change.
I guess the biggest thing is I do not want to have to add in inotifychanged to all my object props to make bindinglist detect changes.
I wish I could set some flag in the SetValueForCell method saying if a change was to happen, then also have an event "EditCompleted" for the vtree that I could use to save the changes.
thx _________________ James M |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Apr 07, 2015 7:19 am Post subject: |
|
|
Why can't you override SetValueForCell and call the base.SetValueForCell method first (which will change the value in the datasource) and then you can serialize your list after that. _________________ Infralution Support |
|
Back to top |
|
|
|