Topic: Button -> Tabsheet

Good morning everybody. Is it possible that when i press a button:  a specific tabsheet on a specific pagecontrol on a specific form will open?

Re: Button -> Tabsheet

Hello.


procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
    Form2.PageControl1.ActivePageIndex := 1; // 0 - first tab, 1 - second tab and so on...
end;
Dmitry.

Re: Button -> Tabsheet

As allways, thanks very much

Re: Button -> Tabsheet

Hello Dmitry,
I have followed your advice on my project. However, I have found that the desired tab sheet does not always open when the button is clicked. Some buttons work, but others do not. Where am I going wrong?  Please see the project.

Post's attachments

Attachment icon Fovea_01.7z 35.98 kb, 263 downloads since 2020-03-29 

Re: Button -> Tabsheet

Hello.


You have a pretty big project, please provide step by step instruction to reproduce the problem.

Dmitry.

6 (edited by eyeman303 2020-03-30 07:11:10)

Re: Button -> Tabsheet

Solved it! big_smile The target tab was in a  PageControl, which was inside another mother PageControl in the target form. So first the appropriate tab of the mother PageControl has to be opened, followed by the target tab of the child PageControl. Now every button working as desired.

Post's attachments

Attachment icon Target_tab.JPG 25.92 kb, 119 downloads since 2020-03-30