Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to make TPanel child components resize on size change of parent TPanel



Permlink Replies: 2 - Last Post: Apr 22, 2017 11:19 PM Last Post By: Eli M
Yusuf Husainy

Posts: 5
Registered: 5/20/17
How to make TPanel child components resize on size change of parent TPanel
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 22, 2017 11:28 AM
Hi All,

I am not sure which forum I will get a faster reply, I understand the delphi forum is more popular so asking the same question here too, hope no one minds that. :)

I am newbie to UI and forms, I have started with "Embarcadero RAD Studio 10.2 Tokyo C++ Builder", and am facing some trouble finding the right API to use. I am using C++ as the programming language.

I have a TPanel component on my FMX form, whose children include a PaintBox, another TPanel and 3 TLabels.

On a button click, I am able to resize the parent TPanel, but the child components do not resize themselves. I may have missed out calling an API, however, I searched through the API list of TPanel components, but could not find any. I also need to redo the font size of the child TLabel components when those TLabel do resize.

Is there a way this auto-scales up and down according to the size of the parent TPanel?

Googling this question created more stress, because it would not return anything closely relevant.

I appreciate any help :)

Regards, Yusuf Husainy.
Douglas Rudd

Posts: 314
Registered: 5/16/97
Re: How to make TPanel child components resize on size change of parent TPanel
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 22, 2017 4:53 PM   in response to: Yusuf Husainy in response to: Yusuf Husainy
Have you tried the Anchors properties on the children? Those will make the component expand with the parent component.
Eli M

Posts: 1,346
Registered: 11/9/13
Re: How to make TPanel child components resize on size change of parent TPanel
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 22, 2017 11:19 PM   in response to: Yusuf Husainy in response to: Yusuf Husainy
Try the Anchor and Align properties.

Also for scaling try TScaledLayout instead of TPanel.

Delphi Boot Camp Day 3 - Building Effective User Interfaces with FireMonkey
https://community.embarcadero.com/blogs/entry/delphi-boot-camp-day-3
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02