How to access active page in FNCPageControl

Hi
I am creating a new page (or TAB) in runtime and wish to change the title of the page. At design time we can see that we need a variable of type TTMSFNCPageControlPage.

image

and we use the following code:

procedure TfrmMain.myFunction;
var
** frm: TfrmPreProc;**
** p: TWebPanel;**
** pg: TTMSFNCPageControlPage;**
begin

** pcMain.DisableBackground;**
** pcMain.Pages.Add;**
** p := TWebPanel.Create(Self);**
** pg := pcMain.Pages[pcMain.pages.count-1]; // <====== Get the error here**
.
.
.
end;

But we get the following Error:

[Error] uMainForm.pas(243): Incompatible types: got "TTMSFNCTabSetTab" expected "TTMSFNCPageControlPage"

If we change the variable type to TTMSFNCTabSetTab we do have access to the attribute "Text".

Please advise how we should do it.

BR
Amin

pg := pcMain.Pages.Add;  

or

pg := TTMSFNCPageControlPage(pcMain.Pages[pcMain.pages.count-1]);