DBAdvGrid is calling the dataset post method when it loses focus.
I had some data editing controls out of the dbadvgrid, and I'm receiving those unwanted posts.
When it loses focus it invokes the DoExit method.
procedure TDBAdvGrid.DoExit;
...
begin
...
FDataLink.DataSet.Post;
...
end;
Does it really should invoke a Post at this point ?
To make it worse and funnier, all my columns are ReadOnly, and goEditing = False, so I have no need for edition/post in this grid.
Meanwhile, I changed its EditPostMode to epCell, so it doesn't call Post.
Thanks for reporting.
We applied an improvement that in case of a full readonly grid, this won't happen when grid.EditPostMode = epRow.
Next update will have this improvement.
Thanks!
And will it keep calling Post when the grid is not read-only ?
I was just thinking about some scenarios when the grid is editable and there may be also some other editable dbcontrol related to the same dataset record. For example, sometimes I put larger db memo fields out of grids , instead of using the memodropdown inplace editor.
When the grid is not read-only, i.e. editing happens, it is needed to call Post.
That explains some problems I had before when started using dbadvgrid. It semms that it would try to post even when the user changes windows to check an email or respond to an instant message from another app. May I suggest something different via a feature request in the near future?
After editing, when moving to another record without a Post would make the edited changes lost
But my point was that losing focus does not mean move to another record. Maybe it lost focus cuz the user just "alt-tabbed" to check his email, and then will go back to the same record again, or will edit some other dbcontrol that points to the same record, but is not part of the grid, as when you have basica data in the grid and a memo outside of it for larger text.
We'd need to know the exact circumstances for triggering on the OnRecordChanged when no real record change has happened. Do you have a test project with which we can reproduce this as it is unclear how this could happen.
Hi!
The issue was just about losing focus. When the grid loses focus, the procedure DoExit is called. It's just that losing focus should not call Post, maybe in some epCell scenario, but in epRow, not even if a column had been edited.
By simply calling Dataset.Edit, a deRecordChange dataevent is generated. No need for a real data change.