Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

ElPageControl Focus-Error

We get some sporatic errors on focus-setting.
Please modifie TElPageControl.SetActivePage(Value: TElTabSheet);


      if Assigned(LForm) and (LForm.Enabled and LForm.Visible) then
      begin
        if (Enabled and Visible) and Multiline then
        begin
            //DOCWARE No Focus if InvalidateRect on a uncreated Window is not, in some cases Exception: no Parent-Window
          try
            if IsControlVisible(Self) then                             <---- New Check
              SetFocus;
          except
          end;
        end;
      end;


Our IsControlVisible-function is:

function IsControlVisible(AControl: TControl): Boolean;
var
  parent: TControl;
begin
  parent := AControl;
  result := False;

  while Assigned(parent) do
  begin
    result := True;

    if parent.Visible = FALSE then
    begin
      result := False;
      parent := nil;
    end
    else
    begin
      parent := parent.Parent;
    end;
  end;
end;


Tagged:

Comments

Sign In or Register to comment.