Anthony Burg
Anthony Burg

Reputation: 570

Can FireMonkey frames be created dynamically?

FireMonkey has the option of using frames (not TFrame, which is a specific kind of visual component), which basically are collections of visual components which can be reused.

http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Working_with_Frames

However, there is nothing in the documentation about creating instances of frames dynamically, instead of placing them at design time on a TForm. Is there a way to create instances of a frame dynamically? When I try to do this, I get errors when attempting to access the frame in question's properties.

Upvotes: 0

Views: 1446

Answers (1)

alitrun
alitrun

Reputation: 1217

TFrame is a simple TControl, you can create and use it as usual Tcontrol component. If you would change TFrame to TControl - nothing change because it is same.

var
  MyFrame: TFrame;

begin
  MyFrame := TFrame.Create(Self); 
  MyFrame.Parent := Self; 

Self is TForm or any other TControl

Upvotes: 1

Related Questions