我在运行时创建嵌套组件。如何Parent
在 a 中分配子组件的属性with
?
with Tspanel.Create(categorypanel) do
begin
parent:=categorypanel; // categorypanel, is a declared variable
height:=30;
visible:=true;
button1 := tsbutton.Create();
// Here is my problem! I want the parent to be the
// panel I've created with the "with tspanel.create(...)"
button1.Parent := ...
end;
我的目标是不为每个组件声明变量。