Recent

Author Topic: TNavigator ApplyUpdates  (Read 6265 times)

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
TNavigator ApplyUpdates
« on: May 07, 2013, 04:56:32 pm »
Since changes to dbgrid aren't applied to the database without using ApplyUpdates, is there any way that I can determine if there are updates pending?  If the user attempts to close the application it would be useful to be able to inform the user that updates were pending.

Thanks in advance
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
Re: TNavigator ApplyUpdates
« Reply #1 on: May 08, 2013, 05:23:47 am »
I have partially solved this.  But need to do some more experimenting to determine which of the many things I tried actually do it - without having unnecessary events activated (that i experimented with).

It seems I must Set DataSource1.AutoEdit := False; so that other events get triggered as necessary for me to know that changes have been made.   Obviously this means I need to Click the Edit button on Navigator to make changes on any row.

I will try to update this with the specific Events required to know if changes have been made to the Datasource (but not applied to the Database) - assuming anyone is interested.
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
Re: TNavigator ApplyUpdates
« Reply #2 on: May 08, 2013, 05:54:04 am »
Is this a bug?

When there are updates pending, clicking Refresh on navigator will raise an EDatabaseError 'Must apply updates before refreshing data'.

It seems to me that if I can keep track of possible updates pending, then Navigator could also - and thus the Refresh Button should be Inactive.  Of course, if it did keep track there could be a simple boolean flag = PendingUpdates (True/false) and save me keeping track of many events.
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

 

TinyPortal © 2005-2018