Sign in Join
FPDoc Onlineexperiment

TUNBPages.AddObject function

Member of TUNBPagespublicIn unit ExtCtrls

Adds the specified page object to the list of pages.

Declaration

pascal
function AddObject(const S: string; AObject: TObject): Integer
 ; override

Arguments

S

Identifier used as the name and caption for the page object.

AObject

Object with the TPage instance stored in the method.

Function result

Ordinal position in the page list where the specified page object was stored.

Description

AddObject is an overridden method in TUNBPages used to add the specified object to the page list maintained in the class instance. It re-implements the virtual method introduced in TStrings, and does not call the inherited method.

S contains the string used to identify the page instance in AObject. The value is used as the Caption for the page object, and as the basis for the Name used in the TPage class instance. The Name for the class instance must be a unique identifier (when specified) in the Components for the TNoteBook control owner. A numeric suffix is appended to the Name value if S is not a unique identifier name on the owner of the TNotebook control. If S is not specified (contains ''), the Name for the class instance is not assigned.

AObject is the page instance added to the internal list. AddObject ensures that AObject is cast to TPage and its properties are initialized:

  • Sets Name to the unique identifier derived from S when S is not an empty string.
  • Sets Caption to the value specified in S (which can be an empty string).
  • Sets Parent to the TNotebook instance which owns the page list.
  • Sets Align to alClient to align the page to the client area for the TNotebook control.
  • Sets Visible to False.
  • Sets control style flags so that the page is not visible at design-time.

The return value is the ordinal position in the internal page list where AObject was stored. If the notebook does not already have an active page, the return value is assigned as the active PageIndex in the notebook control.

AddObject is called from the Add method using the TPage instance created in that method.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.