Henry Olive 5 Posted October 31, 2022 Good Day, I have a PageControl with 4 tabsheets When i move from a tabsheet (for examp. Tabsheet2) to another tabsheet ( for examp. Tabsheet3) I want to find out **from which TabSheet** i came to new TabSheet According to above example tabsheet names i want to find out TabSheet2 Thank You Share this post Link to post
dummzeuch 1505 Posted October 31, 2022 TPageControl has two events for changing pages: OnChanging and OnChanged. Use the first to get the old tabsheet and the second to get the the new one. Share this post Link to post
Remy Lebeau 1399 Posted October 31, 2022 7 hours ago, Henry Olive said: When i move from a tabsheet (for examp. Tabsheet2) to another tabsheet ( for examp. Tabsheet3) I want to find out **from which TabSheet** i came to new TabSheet Unfortunately, the underlying Win32 tab control which TPageControl is built on does not provide that information natively. The TPageControl.OnChanging event is fired BEFORE the active TabSheet changes, and the TPageContro.OnChange event is fired AFTER the active TabSheet is changed. So, you will have to keep track of the previous TabSheet in your own code, eg: private PreviousTabSheet: TTabSheet; procedure TForm1.PageControl1Changing(Sender: TObject; var AllowChange: Boolean); begin PreviousTabSheet := PageControl1.ActivePage; AllowChange := True; end; procedure TForm1.PageControl1Change(Sender: TObject); begin if PreviousTabSheet <> nil then begin // use PreviousTabSheet as needed... PreviousTabSheet := nil; end; end; Share this post Link to post