Default
Google

How can I change my form's properties at run-time?

Applies To: C++Builder 1 or higher
Category: Knowledge Base

In the C++Builder IDE, I can easily change different settings of my form (for example, the Caption) using the Object Inspector. How can I access these settings at run-time?
 
 
 1.
  Start a new project using File | New Application.
 
 2.
  Add a Button and double-click its OnClick event:
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    // Change caption
    Caption = "My Caption";
 
    // Change color
    Color = clBlue;
}
 
As you can see, changing properties at run-time is also very easy. Simply specify the property and the new value.

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange