I have a TFrame with a TEdit component. The frames are created dynamically at runtime as a TTabsheet for a TPageControl. I need to set the TTabSheet.Caption to the TEdit.Text on the TEdits KeyPress method, but, how do I get the owner of the Frame so I can set the Caption?
procedure TKeywordFrame.KeywordNameEditKeyPress( Sender : TObject; var Key : Char );
var
AOwner : TComponent;
begin
if( ord( Key ) = VK_RETURN ) then
begin
AOwner := ?
FKeywordListName := KeywordNameEdit.Text;
with AOwner do
begin
Caption := KeywordNameEdit.Text;
end;
end;
end;
I tried
AOwner := TKeywordFrame.Owner;
DPS.KeywordFrame.pas(272): E2233 Property 'Owner' inaccessible here
AOwner := TKeywordFrame.GetOwner();
DPS.KeywordFrame.pas(272): E2076 This form of method call only allowed for class methods or constructor
Maybe I am rummaging through the wrong haystack for a needle.