Enable/Disable all controls of the form

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34655
    Marcos R.
    Participant

    How can I enable/disable all controls of the form ?

    I did a procedure, but does not work:

    Code:
    procedure Status(sForm: Tform; bHab: boolean);
    var
    x : integer;
    nome: String;
    begin
    for x := 0 to sForm.ControlCount – 1 do
    if (sForm.Controls[x] is TsButton) then
    begin
    sForm.Controls[x].Enabled := bHab;
    end;
    end;
    #46165
    Marcos R.
    Participant

    I did it !

    Here is the code:

    Code:
    procedure Status(sForm: Tform; bHab: boolean);
    var
    iA : integer;
    AComponent: TComponent;
    begin
    for iA := 0 to sForm.ComponentCount – 1 do
    begin
    if sForm.Components[iA] is TsButton then
    begin
    AComponent := sForm.FindComponent(sForm.Components[iA].Name);
    if Assigned(AComponent) then
    if AComponent is TControl then
    TControl(AComponent).Enabled := bHab;
    end;
    end;
    end;

    Thanks,

    Marcos

    #46166
    gispos
    Participant

    What does this have to do with AlphaControls :cs:

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.