Including the Form Unit

From RAD Studio
Jump to: navigation, search

Go Up to Creating the Component Interface


For your wrapper component to initialize and display the wrapped dialog box, you must add the form's unit to the uses clause of the wrapper component's unit.

Append About to the uses clause of the AboutDlg unit.

The uses clause now looks like this:

uses
  Windows, SysUtils, Messages, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms,
  About;
// for C++
#include "About.h"
#pragma link "About.obj"

The form unit always declares an instance of the form class. In the case of the About box, the form class is TAboutBox, and the About unit includes the following declaration:

var
  AboutBox: TAboutBox;
extern TAboutBox *AboutBox;

So by adding About to the uses clause, you make AboutBox available to the wrapper component.