- This topic has 4 replies, 2 voices, and was last updated 4 years, 8 months ago by Rafał Drzewiecki.
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
March 10, 2020 at 11:43 pm #68582Rafał DrzewieckiParticipant
Can you add this in next update AC? In this or more extensive form. This is Event OnPageChangeTab. Reacts to: Change Tab by mouse, ActivPageIndex and delete Tab.
type TacTabChange = procedure(Sender: TComponent) of object; TsPageControl = class(TPageControl) private FOnPageChangeTab: TacTabChange; published property OnPageChangeTab: TacTabChange read FOnPageChangeTab write FOnPAgeChangeTab; end; procedure TsPageControl.SetActivePage(const Value: TsTabSheet); begin if Value <> nil then begin inherited ActivePage := CheckActiveTab(Value.PageIndex); AddToAdapter(ActivePage); if not Value.TabVisible and not SkinData.FUpdating then SetParentUpdated(Value); // Update because TCM_SETCURSEL is not received //Rafal if Assigned(OnPageChangeTab) then OnPageChangeTab(Self); end else inherited ActivePage := nil; end; procedure TsPageControl.SetActivePageIndex(const Value: Integer); begin if IsValidIndex(Value, PageCount) and (TsTabSheet(Pages[Value]).TabType = ttTab) then begin inherited ActivePageIndex := Value; if not Pages[Value].TabVisible then SetParentUpdated(Pages[Value]); // Update because TCM_SETCURSEL is not received //Rafal if Assigned(OnPageChangeTab) then OnPageChangeTab(Self); end; end; destructor TsTabSheet.Destroy; var ParentTab: TWinControl; begin if AnimTimer <> nil then FreeAndNil(AnimTimer); FreeAndNil(FCommonData); //Remember parent ParentTab := Parent; inherited; //Rafal if (ParentTab is TsPageControl) and (Assigned(TsPageControl(ParentTab).OnPageChangeTab)) then TsPageControl(ParentTab).OnPageChangeTab(TsPageControl(ParentTab)); end;
March 11, 2020 at 1:45 pm #68583HeDiBoParticipantCan you explain which problem this change solves that is not handled by the OnChanging and OnChange events?
March 12, 2020 at 12:49 am #68584Rafał DrzewieckiParticipantHi, OnChanging and OnChange not handled:
PageControl.ActivPageIndex := 2;
PageControl.ActivPageIndex := 1;and
PageControl.ActivPageIndex = 3;
PageControl.Pages[2].Free;March 12, 2020 at 7:41 pm #68585HeDiBoParticipantVery 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;
March 12, 2020 at 10:52 pm #68586Rafał DrzewieckiParticipantYes 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;
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.