TUniQuery: delete record does not set modified property?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kribo
Posts: 12
Joined: Thu 13 May 2010 15:51

TUniQuery: delete record does not set modified property?

Post by kribo » Fri 24 Jun 2011 00:45

Hi,
I'm using TUniQuery (name UniQuery) and attach a DBGrid to it. Place a button (name btnChange, default Enabled = FALSE) on the form and attach it to an action with expression "btnChange.enabled := UniQuery.modified". I delete some records in DBGrid, expecting this will trigger the btnChange to be enabled but, no reaction takes place. How to make the idea works? Thank you in advance..

(*edit:
CachedUpdates = TRUE
LocalUpdate = TRUE
*)

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 24 Jun 2011 12:44

Hello,

The Modified property indicates changes in the current record, but not in all DataSet, i.e., if you make changes to some record and repeat this property in, for example, the BeforePost event, it will be True, and if you delete a record, the value of this property will not change.
To change the button state on delete, you can add the following code to the AfterDelete event of the UniQuery component:

Code: Select all

btnChange.enabled:= true;

kribo
Posts: 12
Joined: Thu 13 May 2010 15:51

Post by kribo » Fri 24 Jun 2011 14:29

Hi Alex,

Thanks for the reply and solution, it's working now! :lol:

Actually, I was trying to mimic some ClientDataset features and wondering if it is possible to do with Unidac alone. Those features such as
Changecount, Undolastchange, Aggregates, etc, which are very useful for dataset editing navigation and control.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 29 Jun 2011 09:56

Hello,

Thank you for the information.
You can add your suggestions concerning implementing new functionality at our UserVoice page at http://devart.uservoice.com/forums/1046 ... 939-unidac . If enough people votes for your suggestions, they will be implemented.

Post Reply