We have a graphical interface of several frames that dynamically create their contents. Each frame creates panels, labels, changes, comboboxes, etc., which will be used as input fields. This works very well, and we also plan to provide each frame with its contents in separate streams.
However, there is one big problem: it is rather slow! Creating controls does not take time, but setting the Parent property seems very time-consuming.
I tried several ways to speed things up, but no luck. I tried Enabled = False, Visible = False, DisableAlign, LockWindowUpdate, WM_SETREDRAW ... but nothing affects the lengthy process of setting the control parent.
Even if we use streams, it will take time, since VCL functions must be called in Synchronize.
Is there any other way to speed up the creation and display of controls?
Regards, Magnus
Edit: The GUI does not have any data-dependent components or any events. I just create controls and display them. Using timers, I defined the purpose of the parent controls (AControl.Parent: = AOwner) as part of the time.
Edit 2: As shown in the answer below, the speed issue does not specify the parent element, but the color of the control. When I checked the time when the container was visible, and setting the parent caused the control to paint immediately.
Edit 3: Another part of our dynamic GUI is assigning items to combo boxes. ComboBox.Items.Assign (DataItems), where DataItems has at most three to six elements.
Thanks for taking the time to help me!
user-interface dynamic delphi
Magnus rosendahl
source share