PageControl add/update new function

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #68583
    HeDiBo
    Participant

      Can you explain which problem this change solves that is not handled by the OnChanging and OnChange events?

      #68584
      Rafał Drzewiecki
      Participant

        Hi, OnChanging and OnChange not handled:

        PageControl.ActivPageIndex := 2;
        PageControl.ActivPageIndex := 1;

        and

        PageControl.ActivPageIndex = 3;
        PageControl.Pages[2].Free;

        #68585
        HeDiBo
        Participant

          Very simple to build this yourself:

          procedure SetActiveTab(PC: TsPageControl; PageNr: Integer);
          var
             Accept: Boolean;
          begin
             PC.OnChanging(PC, Accept);
             if not Accept then Exit;
             PC.ActivePageIndex := PageNr;
             PC.OnChange(PC);
          end;
          
          #68586
          Rafał Drzewiecki
          Participant

            Yes ofcurse, This procedure is simple to write but you have to remember about it. This is only for changing tabs programmatically. It is necessary to write one more for TabSheet.Free;

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