Runtime design - storing and loading form layout (recursively?)
Asked Answered
I

1

6

I'm creating an application which layout needs to be fully configurable on client-side. It means each component (control) can be resized and moved around the form, new controls can be added, or some removed. I'd like to use JVCL Runtime Design (Design Surface and Object Inspector).

The problem is about storing and loading the form. TStream.WriteComponent method doesn't support recursive writing, which means it saves just the "first level" of components.

So, by example, if I put a TPanel on a Form, then TButton on the Panel, and call WriteComponent on a Form, only TPanel will be saved, not the TButton.

My question is - *how do I use WriteComponent to store full control hierarchy?

Individuate answered 15/8, 2011 at 14:27 Comment(0)
F
11

You should make the form the Owner of all components even if the Parent is different. Regarding your example, the button and the panel should both be owned by the form.

Fleer answered 15/8, 2011 at 14:34 Comment(1)
thank you. I thought "ownership" hierarchy is supposed to follow "parentship"Individuate

© 2022 - 2024 — McMap. All rights reserved.