Author Topic: Dataset EnableControls/DisableControls  (Read 501 times)

luca

  • Jr. Member
  • **
  • Posts: 91
Dataset EnableControls/DisableControls
« on: May 28, 2026, 12:10:13 pm »
Hi,
I'm working on Windows 11.

I've compiled my applications with the last version of Lazarus (4.6 32/64 bits).

I've this code
Code: Pascal  [Select][+][-]
  1. ...
  2.  qry.DisableControls;
  3.  qry.Close;
  4.  qry.Open;  
  5.  if qry.eof then exit;
  6. ...
  7.  

With the program compiled with Lazarus version 2.2.0 all is fine: no error when I move to the grid linked to the qry dataset.
With version 4.6 I receive an Access violation when I move to the grid.

I know, there is a problem on code above: if the qry is empty the controls are not enable again because no call to EnableControls is done before exit.

But my question is: has anything changed in the new version regarding the management of data controls?

Thanks

Sharfik

  • New member
  • *
  • Posts: 8
Re: Dataset EnableControls/DisableControls
« Reply #1 on: June 10, 2026, 07:40:21 am »
full code version can see?

1HuntnMan

  • Sr. Member
  • ****
  • Posts: 463
  • From Delphi 7 to Lazarus
    • NewFound Photo Art
Re: Dataset EnableControls/DisableControls
« Reply #2 on: August 10, 2026, 09:31:58 pm »
Try removing qry.DisableControls and see how that works for you...

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1319
Re: Dataset EnableControls/DisableControls
« Reply #3 on: August 11, 2026, 03:37:42 pm »
I know, there is a problem on code above: if the qry is empty the controls are not enable again because no call to EnableControls is done before exit.

But my question is: has anything changed in the new version regarding the management of data controls

I have a few database apps, and I'm recompiling these all the time.  All have grids, and most having reporting/export code that iterates through datasets similar to your above, and I've seen no changes to the management of data controls in any of my apps.

Can you paste more complete code that reproduces your issue?
Lazarus Trunk/FPC latest fixes on Windows 11
  How to use the forum:  https://wiki.lazarus.freepascal.org/Forum

 

TinyPortal © 2005-2018