C Builder TForm 未正确分配或创建其所有控件
我想知道如何检查表单上的所有控件是否已创建并初始化。
当用户按下 update 按钮时,我会显示一个表单。它只有一个 TProgressBar 控件。
该控件的句柄不为 NULL,并且在随机阶段它可以或不能设置位置/最大值。
当我将 TProgressBar->Max 值设置为某个整数后,它仍然为 0。
所以问题是:
如何真正创建表单及其上的所有控件(我目前仅使用 Form->Show() 方法,我可以检查该方法调用构造函数)
此外,我在主 cpp 文件中有以下表单创建代码:
Application->CreateForm(__classid(TupdateProgramForm), &updateProgramForm);
如何检查表单上的所有控件是否已创建并绘制(显示且可见)
I'd like to know how I can check that all the controls on the form are created and initialized.
I have a form I am showing when a user presses the update button. It has only a TProgressBar control.
The handle is not NULL for this control and at random stages it can or can't set the Position/Max values.
When I set TProgressBar->Max
value to some integer it remains 0 after.
So the question is:
How to really create the form and all controls on it (i am currently using just Form->Show() method, which as I can check calls the constructor)
Also I have following form creation code in main cpp file:
Application->CreateForm(__classid(TupdateProgramForm), &updateProgramForm);
How to check that all controls on the form are created and PAINTED (showed and visible)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 C++ Builder 中,设计时创建的窗体和控件通过生成 Delphi 代码的自动脚本转换为二进制对象。
要查看原始的 Delphi 代码,只需在设计时右键单击表单上的任意位置,然后选择“以文本形式查看”。这将显示窗体及其控件的 Delphi 源代码。
In C++ Builder the form and the controls created at design-time are translated into binary objects through automatic scripts that produce Delphi code.
To view the originated Delphi code just right-click anywhere on form at design-time and select 'View as text'. This will show the Delphi source code of the form and it's controls.
创建窗体和所有子控件后,将调用该窗体的 OnCreate 事件,您可以在此事件中放置初始化和检查代码,例如:
After a form and all child controls created, the OnCreate event of that form invoked and you can place your initialization and checking code in this event, for example: