开发者

C Builder TForm not allocated or created properly all its controls

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开发者_StackOverflow中文版 question is:

  1. 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);

  2. How to check that all controls on the form are created and PAINTED (showed and visible)


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.


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:

void __fastcall TfrmMain::updateProgramFormCreate(TObject *Sender)
{
   ProgressBar->Max = 100;
   ProgressBar->Value = 20;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜