Tabsheets in Form policy

I wanted to hide some tabsheets using a form policy but was surprised that they were not in the list of components.  I found that it was a simple matter to add them in the procedure TuilFormPolicyDlg.AddComponents(EditForm: TForm; AForm: TfrmFormPolicy) and the code to show/hide enable/disable them appears to be in the code so I suspect this was taken out for some reason.  Is this just an oversight or is there a reason they do not appear?

I have retested this here by adding a TPageControl on the mainform of the security system demo and edit the form policy, but all tabsheets are visible in the policy editor. The tabsheets are organised under node TTabSheet in the Components hierarchy. What do you do different in your app?

I am using your AdvPager but only the pager not the tabsheets appeared in the form policy editor's component list until I edited the following procedure in your code (I've put my initials around the code I changed).  I'm don't see how it can be different for you if you are using the same version as me.  The component shows it's version as 2.4.3.1


procedure TuilFormPolicyDlg.AddComponents(EditForm: TForm; AForm: TfrmFormPolicy);

var

  j       : Integer;

  PropInfo: PPropInfo;

  Allow   : Boolean;



begin

  for j := 0 to EditForm.ComponentCount - 1 do // Iterate

  begin

    if not IgnoreList.IsIgnored(EditForm.Components[j]) then

    begin

      // find all components with Enabled, Visible or ReadOnly property

      PropInfo := TypInfo.GetPropInfo(EditForm.Components[j].ClassInfo, 'Enabled');

      if PropInfo <> nil then

      begin

        Allow := True;



        if Assigned(OnFilterComponent) then

          OnFilterComponent(Self, EditForm.Components[j], Allow);



        if Allow then

          AddToList(AForm, EditForm.Components[j].Name, EditForm.Components[j].ClassName)

      end

      else

      begin

        PropInfo := TypInfo.GetPropInfo(EditForm.Components[j].ClassInfo, 'Visible');

        if PropInfo <> nil then

        begin

          Allow := True;



          if Assigned(OnFilterComponent) then

            OnFilterComponent(Self, EditForm.Components[j], Allow);



          AddToList(AForm, EditForm.Components[j].Name, EditForm.Components[j].ClassName);

        end

        else

        begin

          PropInfo := TypInfo.GetPropInfo(EditForm.Components[j].ClassInfo, 'ReadOnly');

          if PropInfo <> nil then

          begin

            Allow := True;



            if Assigned(OnFilterComponent) then

              OnFilterComponent(Self, EditForm.Components[j], Allow);



            AddToList(AForm, EditForm.Components[j].Name, EditForm.Components[j].ClassName);

          end

          { + SJS  2012-11-23 }

          else

          begin

            PropInfo := TypInfo.GetPropInfo(EditForm.Components[j].ClassInfo, 'TabVisible');

            if PropInfo <> nil then

            begin

              Allow := True;



              if Assigned(OnFilterComponent) then

                OnFilterComponent(Self, EditForm.Components[j], Allow);



              AddToList(AForm, EditForm.Components[j].Name, EditForm.Components[j].ClassName);

            end

            else

            begin

              PropInfo := TypInfo.GetPropInfo(EditForm.Components[j].ClassInfo, 'TabEnabled');

              if PropInfo <> nil then

              begin

                Allow := True;



                if Assigned(OnFilterComponent) then

                  OnFilterComponent(Self, EditForm.Components[j], Allow);



              end;

            end;

          end;

          { - SJS  2012-11-23 }

        end;

      end;

      AForm.tvComponents.FullExpand;

      AForm.tvComponents.Selected := AForm.tvComponents.Items.GetFirstNode;

      AForm.tvComponents.AlphaSort;

    end;

  end; // for

end; 




You're correct that it isn't checked for TabVisible / TabEnabled. We've applied these extensions. Next update will have this improvement.