The C++Builder 25th Anniversary: Historical Article on C++ Builder Language Extension - Delphi-PRAXiS

General News

Summary

This is the plain code you can use to create a component of a given class at runtime, and place it inside a ScrollBox control: void __fastcall TForm1::BtnNewEditClick(TObject *Sender){ TEdit* edit = new TEdit (this); edit->Parent = ScrollBox1; edit->Left = random (ScrollBox1->Width); edit->Top = random (ScrollBox1->Height); edit->Text = "Edit" + IntToStr (++Counter);} This is the code you can use to create a component of the same type of the Sender object: void __fastcall TForm1::OnDynNew(TObject *Sender){ TClass myclass = Sender->ClassType(); // illegal: // TComponent* Comp = new myclass (this); TComponent* Comp = DynCreate (myclass, this); TControl* Control1 = dynamic_cast (Comp); if (Control1 != 0) { Control1->Parent = ScrollBox1; Control1->Left = random (ScrollBox1->Width); Control1->Top = random (ScrollBox1->Height); Control1->Name = "Comp" + IntToStr (++Counter); }}; Conclusion As we have seen, Borland added many news features to the C++ language in C++ Builder to make this language compatible with Object Pascal, and tailored for component-based programming. Needless to say the Compupserve contact information and web site above are not valid any more, but I decided to leave the article as it was originally published including my bio. This is the plain code you can use to create a component of a given class at runtime, and place it inside a ScrollBox control:void __fastcall TForm1::BtnNewEditClick(TObject *Sender){ TEdit* edit = new TEdit (this); edit->Parent = ScrollBox1; edit->Left = random (ScrollBox1->Width); edit->Top = random (ScrollBox1->Height); edit->Text = "Edit" + IntToStr (++Counter);} This is the code you can use to create a component of the same type of theobject:void __fastcall TForm1::OnDynNew(TObject *Sender){ TClass myclass = Sender->ClassType(); // illegal: // TComponent* Comp = new myclass (this); TComponent* Comp = DynCreate (myclass, this); TControl* Control1 = dynamic_cast (Comp); if (Control1 != 0) { Control1->Parent = ScrollBox1; Control1->Left = random (ScrollBox1->Width); Control1->Top = random (ScrollBox1->Height); Control1->Name = "Comp" + IntToStr (++Counter); }};As we have seen, Borland added many news features to the C++ language in C++ Builder to make this language compatible with Object Pascal, and tailored for component-based programming. Thelibrary, in fact, allows you to leverage visual programming and work at a higher abstraction than the typical C++ Windows class libraries.There are many other differences between Delphi and C++Builder, but the implementation of properties is the feature with the highest impact in term of C++ language extensions. Most of the other issues (message maps, sets, and open array parameters, to name just a few) have been solved using existing C++ keywords and language features.Needless to say the Compupserve contact information and web site above are not valid any more, but I decided to leave the article as it was originally published including my bio.

Classifications

industries
Fintech & Banking
applications
Anti Piracy

AskAI Classifications

Labels
Software Development Tools Integrated Development Environment (IDE) Database Software

Linked Companies

Embarcadero Technologies
$50M to $100M