On Sun, 7 May 2017, kapibara via Lazarus wrote:

I made a test app to unerstand more about TSQLQuery events. It requires SQLite and has one table with three records.

1) Why does the dataset scroll 6 times to open a query that has a resultset with three records?

2) Also, directly after opening the query, why is BeforeScroll/AfterScroll triggered when you click the first item in the DBLookupListBox? Shouldn't the dataset already be on that position and no scroll needed? Later, if you click an item twice, only the first time triggers a scroll event.

3) At query open, why does it scroll from record 1 an then immediately to record 3? (First and last record) and then to record 1 again, followed by 2, 3 and 3 again? Yes, why does it scroll from record 3 two times in a row? Toggle "Active Query" to true and immediately look at the Log window, line 4 and 5.

4) Editing and posting a name gives rise to 6 more scrolls.

Explanations whats going on are highly welcome.

Never use a GUI to understand dataset events.

Because what you get is a mix of how TDataset behaves and how the DB aware 
controls
behave. The DB aware controls do the most strange things imaginable in order
to accomodate whatever their designer thought necessary.

TDataset just reacts on the commands that the controls give.

So, if you want to understand how TDataset events work, you should only use a command-line program, and issue a command (open, next, edit etc), and see how the TDataset reacts.

Michael.
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to