Es müsste so funktionieren:
Delphi-Quellcode:
procedure TMessageForm.CreateTab(Name, Caption: String);
var
i: Integer;
ATab: TTabSheet;
AFrame: TMsgFrame;
begin
if not Assigned(FindComponent(Name)) then begin
ATab := TTabSheet.Create(MessageForm);
ATab.Caption := Caption;
ATab.PageControl := PControl; //PControl ist mein PageControl
AFrame := TMsgFrame.Create(MessageForm);
AFrame.Name := Name; //von hier
AFrame.Parent := ATab;
end else
((FindComponent(Name) as TMsgFrame).Parent as TTabSheet).Highlighted := True;
end;