Class TCommonPropertyGroup (unit Commncmd)

Inherits from

TComponent

CommnCmd.pas (c) 1996 Dwayne Mercredi declares classes TCommonPropertyGroup, TCommonCommand class TCommonPropertyGroup: base class for any group of components on a single form that share a number of properties or events; you can simply place the shared properties in a descendant class of TCommonPropertyGroup, override a few methods, and setting the properties in the common property group will set the properties of all contained components class TCommonCommand: implements a common command with Enabled, Checked, and OnClick. Allows only TButton, TSpeedButton, and TMenuItem components to be added to the group. Enabled controls the enable state of all contained components OnClick points to the event handler for OnClick for all contained components Checked is reflected in the Checked state of TMenuItems and the Down state of TSpeedButtons. It is ignored for TButtons.

Constructors


constructor Create(AOwner: TComponent);

--------------------------------------------------------------------- class TCommonPropertyGroup ---------------------------------------------------------------------


Functions

procedure Add(Item: TComponent);

procedure Add adds component to list if CanAdd returns true for the given component

synchronize


procedure Assign(Source: TPersistent);

procedure Assign allows assignment of PropertyGroups to one another

function CanAdd(AComponent: TComponent): Boolean;

function CanAdd returns whether or not the given component can be added to the list.

procedure Clear;

procedure Clear clears all components from the list

add and synchronize


function Contains(Item: TComponent): Boolean;

function Contains returns true iff the given component is in the list

destructor Destroy;


procedure Remove(Item: TComponent);

procedure Remove removes the given component from the list if it is in the list

procedure SynchronizeAll;

procedure SynchronizeAll calls Synchronize with all components in list

no synchronization to do


procedure DefineProperties(Filer: TFiler);

procedure DefineProperties sets up ReadGroup and WriteGroup to read and write the list of components to the given filer

procedure Loaded;

procedure Loaded sets up the list of components given the names.

procedure Notification(AComponent: TComponent; Operation: TOperation);

procedure Notification Removes component from list if the notification is of Removal

procedure ReadGroup(Reader: TReader);

procedure ReadGroup reads the list of component names from the given Reader

procedure Synchronize(AComponent: TComponent);

procedure Syncronize used to syncronize the given component with the state of the common property group.

procedure WriteGroup(Writer: TWriter);

procedure WriteGroup writes the list of component names to the given writer

read the components name and add to internal list


function GetComponentAt(Index: Integer): TComponent;


function GetCount: Integer;


Properties

property Count : Integer

property Count returns the number of components in list

property Group : TComponent

property Group zero based array of components within this common property group range of Index: 0 .

Events

Variables

FComponentList : TStrings;



Constructors


constructor Create(AOwner: TComponent);

--------------------------------------------------------------------- class TCommonPropertyGroup ---------------------------------------------------------------------


Functions


procedure Add(Item: TComponent);

procedure Add adds component to list if CanAdd returns true for the given component

synchronize


procedure Assign(Source: TPersistent);

procedure Assign allows assignment of PropertyGroups to one another


function CanAdd(AComponent: TComponent): Boolean;

function CanAdd returns whether or not the given component can be added to the list. Should return True for only appropriate components. Returns true if not already in list

default action


procedure Clear;

procedure Clear clears all components from the list

add and synchronize


function Contains(Item: TComponent): Boolean;

function Contains returns true iff the given component is in the list


destructor Destroy;


procedure Remove(Item: TComponent);

procedure Remove removes the given component from the list if it is in the list


procedure SynchronizeAll;

procedure SynchronizeAll calls Synchronize with all components in list

no synchronization to do


procedure DefineProperties(Filer: TFiler);

procedure DefineProperties sets up ReadGroup and WriteGroup to read and write the list of components to the given filer


procedure Loaded;

procedure Loaded sets up the list of components given the names. Searches the Owner's list of components for the names

write the components name


procedure Notification(AComponent: TComponent; Operation: TOperation);

procedure Notification Removes component from list if the notification is of Removal


procedure ReadGroup(Reader: TReader);

procedure ReadGroup reads the list of component names from the given Reader


procedure Synchronize(AComponent: TComponent);

procedure Syncronize used to syncronize the given component with the state of the common property group. Called for each component when it is added to the list and whenever SyncronizeAll is called

only can add if it isn't already in list


procedure WriteGroup(Writer: TWriter);

procedure WriteGroup writes the list of component names to the given writer

read the components name and add to internal list


function GetComponentAt(Index: Integer): TComponent;


function GetCount: Integer;


Properties


property Count : Integer

property Count returns the number of components in list


property Group : TComponent

property Group zero based array of components within this common property group range of Index: 0 .. Count - 1


Events


Variables


FComponentList : TStrings;