[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppBuilderCreateAnotherForm
Do, when the ChooseYourFighter Form is in focus:
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppBuilderCreateAnotherForm
(C++ Builder) Add another Form to your main Form in
There are five options:- 1) Single document interface, static other Form
- 2) Single document interface, dynamically allocated other Form
- 3) Multiple document interface, static other Form
- 4) Multiple document interface, dynamically allocated other Form
- 5) Add a Form in another Form, like a ?TPanel
Single document interface, static other form
Do, when your Main Form is open only: 'Project | Add to Projects | UnitOtherForm.cpp' 'File | Include Unit Hdr' and select 'UnitOtherForm.cpp' To make the other From visible, type:OtherFrom->Show();
Single document interface, dynamically allocated other form
This example is for a fighting game, in which the user is in the 'Choose your fighter' screen, and is done. Then, a 'Loading game' screen appears, until the main game screen appears (which needs time to initialize the game).Do, when the ChooseYourFighter Form is in focus:
- 'File | Include Unit Hdr' and select 'UnitLoadingScreen.cpp'
- 'File | Include Unit Hdr' and select 'UnitGameMain.cpp'
void __fastcall TFormChooseFighter::OnButtonDoneClick(TObject * Sender) { this->Hide(); const std::auto_ptr<TFormLoadingScreen> formLoadingScreen(new TFormLoadingScreen(this)); formLoadingScreen->Show(); const std::auto_ptr<TFormGameMain> formGameMain(new TFormGameMain(this)); formLoadingScreen->Hide(); formGameMain->ShowModal(); this->Show(); }
- include <memory>
Multiple document interface, static other Form
Later, nearly same like SDI.Multiple document interface, dynamically allocated other Form
Later, nearly same like SDI.Add a Form in another Form, like a ?TPanel
As TForm inherits from TWinControl, see adding VCL TWinControl dynamically or ?adding CLX TWinControl dynamically. Do not forget to set the TForm's BorderStyle to bnNone.Topic links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
