I'm creating a new instance of a form and trying to show it as a child from on a PANEL. But The form doesn't seem to be usable. I mean I cannot edit any textbox. But there are other controls like the tree and button that seem clickable.
我正在创建一个表单的新实例,并尝试将其显示为来自PANEL的子项。但这种形式似乎并不可用。我的意思是我无法编辑任何文本框。但还有其他控件,如树和按钮,似乎可点击。
Here is the code:
这是代码:
procedure TForm1.ProcfrmSetupItemCategories;
var
NewForm: TfrmSetupItemCategories;
begin
NewForm:=TfrmSetupItemCategories.Create(BodyPanel);
NewForm.Parent := BodyPanel;
NewForm.Top:=5;
NewForm.Left:=5;
NewForm.Show;
end;
But if I remove the line NewForm.Parent := BodyPanel;
the form is editable but it goes out of the parent form/Panel.
但是,如果我删除行NewForm.Parent:= BodyPanel;表单是可编辑的,但它超出了父表单/ Panel。
Also when the parent is set, the child form is not active (looking at the title bar)
此外,当设置父级时,子表单不活动(查看标题栏)
Am I missing something? Please advice. Thanks!
我错过了什么吗?请指教。谢谢!
1 个解决方案
#1
0
A Form needs to be a child of other forms or TApplication. The TPanel does not know how to manage forms so your form will not get activated and its components will not receive focus.
表格需要是其他表格或TApplication的孩子。 TPanel不知道如何管理表单,因此您的表单不会被激活,其组件将无法获得焦点。
Instead you could use normal forms and write a procedure to align your forms. Now add a timer to your main form and call the alignment procedure from the ontimer event. As the user moves or resizes the main form, the other forms re-align.
相反,您可以使用普通表单并编写一个过程来对齐表单。现在为主窗体添加一个计时器,并从ontimer事件中调用对齐过程。当用户移动或调整主窗体的大小时,其他窗体会重新对齐。
Dave Peters DP Software
戴夫彼得斯DP软件
#1
0
A Form needs to be a child of other forms or TApplication. The TPanel does not know how to manage forms so your form will not get activated and its components will not receive focus.
表格需要是其他表格或TApplication的孩子。 TPanel不知道如何管理表单,因此您的表单不会被激活,其组件将无法获得焦点。
Instead you could use normal forms and write a procedure to align your forms. Now add a timer to your main form and call the alignment procedure from the ontimer event. As the user moves or resizes the main form, the other forms re-align.
相反,您可以使用普通表单并编写一个过程来对齐表单。现在为主窗体添加一个计时器,并从ontimer事件中调用对齐过程。当用户移动或调整主窗体的大小时,其他窗体会重新对齐。
Dave Peters DP Software
戴夫彼得斯DP软件