Jump to content
luciano_f

Permanently the "Lock Controls" in IDE

Recommended Posts

Every form I open I have to deactivate and activate "Lock Control" again. Is there any tool or way to do this automatically ?

Edited by luciano_f

Share this post


Link to post

By locking you mean they cannot be interacted with?

If yes, just write a recursive method to walk through your form, disabling / enabling your controls in the process:

 

Procedure TForm3.LockControls(Const inLockControls: Boolean; inParent: TWinControl = nil);
Var
  a: Integer;
Begin
  If Not Assigned(inParent) Then
    inParent := Self;

  For a := 0 To inParent.ControlCount - 1 Do
  Begin
    inParent.Controls[a].Enabled := Not inLockControls;

    If inParent.Controls[a] Is TWinControl Then
      LockControls(inLockControls, inParent.Controls[a] As TWinControl);
  End;
End;


 

Share this post


Link to post
2 minutes ago, aehimself said:

By locking you mean they cannot be interacted with?

If yes, just write a recursive method to walk through your form, disabling / enabling your controls in the process:

 


Procedure TForm3.LockControls(Const inLockControls: Boolean; inParent: TWinControl = nil);
Var
  a: Integer;
Begin
  If Not Assigned(inParent) Then
    inParent := Self;

  For a := 0 To inParent.ControlCount - 1 Do
  Begin
    inParent.Controls[a].Enabled := Not inLockControls;

    If inParent.Controls[a] Is TWinControl Then
      LockControls(inLockControls, inParent.Controls[a] As TWinControl);
  End;
End;


 

 

In Delphi there is an option in "Edit" -> "Lock Controls" but this option I have to disable and enable again for each form that opens, I would like to do this automatically once only and all the forms that I open are already locked I believe it must be something related to OTA but I don't know how to do it

 

https://github.com/DGH2112/DGH-IDE-Notifiers/blob/master/Source/DGHIDENotifiers.FormNotifier.pas

 

 

Share this post


Link to post
3 minutes ago, aehimself said:

If yes, just write a recursive method to walk through your form, disabling / enabling your controls in the process:

No, He means this:

image.thumb.png.e7dfc8e01e0df915c465d8dd0e5fbe11.png

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×