Query.DisableControls - Exception on click lazarus / 16-Databases ---------------------------------------------------------------------- fpcoder · 2014-02-18 03:40 I wanted the content of a DBGrid to stay visible after closing both datasets and transactions. That succeded by calling: Query.DisableControls And then: Connection.CloseDataSets; Connection.CloseTransactions; DBGrid looks fine while the Transaction and Query is temporarily deactivated. Problem: If the grid is clicked or scrolled there is an exception. I thought that if the control is disabled it shouldn't react to mouse or keyboard? If the grid is not clicked or otherwise tampered with, then its no problem and after Query.EnableControls it runs like before disabling it. Is there a fix for this? ---------------------------------------------------------------------- Mike.Cornflake · 2014-02-18 04:36 Query.DisableControls doesn't actually disable the controls.  It provides a mechanism to allow those controls to know not to respond to certain database messages.  Definitely a useful call, usually made before scrolling through a dataset in code.  By setting .DisableControls, then any grid hooked up for instance knows not to scroll to the next record when you call Query.Next. I'm thinking you maybe need to insert a DBGrid.Enabled := False as well. ---------------------------------------------------------------------- fpcoder · 2014-02-18 05:31 I attempted DBGrid.Enabled := False but get Exception - SIGSEGV when the calling procedure returns. Perhaps its not possible to do this with a dataaware control. Quote from: Mike.Cornflake on February 18, 2014, 05:36:45 amI'm thinking you maybe need to insert a DBGrid.Enabled := False as well. ---------------------------------------------------------------------- Mike.Cornflake · 2014-02-18 05:59 Can you post your full code? ---------------------------------------------------------------------- exdatis · 2014-02-18 06:14 Also, as prevention, you can handle the event onClick. ---------------------------------------------------------------------- mangakissa · 2014-02-18 08:15 Why not using a memorytable? ---------------------------------------------------------------------- fpcoder · 2014-02-20 04:20 The problem have somehow disappeared and I dont know what caused it. Made a test app in Delphi7. You can try to click and scroll as much as you like after Query.Disablecontrols. And it is the same in Lazarus now. We'll see if it happens again, then I'll try to pinpoint why. Thanks for all the answers. @mangakissa: I'll look into the memdataset, might be useful.