Copyright: Copyright ©


class_TInstall
TInstall Component

Properties	Methods	Events

Author

  Bill White

  3117 Raymond Drive

  Atlanta, GA 30340

 (404)457-5348.

 CompuServe Address:  73612.3477@compuserve.com

Version Information

This is version 2.0 of the TInstall Component.

USES

TInstall

Property Editor Help

This is help for the various property editors.

Aliases Property Editor

FileGroups Property Editor

Files Property Editor

RSConnections Editor

WindowGroup Property Editor

Description

The Install component provides generic installation services for applications written in Delphi.  The TInstall component provides handling for copying files, adding aliases to the BDE, adding program items, and installing ReportSmith connections.  The TInstall component also publishes events that allow you to override any or all of the default installation dialogs, at design time.  And because the TInstall component is written in Delphi, you can create your own descendant types of the TInstall component.  Note:  The TInstall component does not install the BDE nor ReportSmith; you must use the BDE install program and the ReportSmith Install programs.   For an example on how to do this see the BDE Install Example.  Important:  You must run the BDE Install program before you call the Execute method, if you are going to install aliases.  Similarly, you must run the ReportSmith Install program before you call the Execute Method, if you are going to install ReportSmith connections.

The TInstall component allows you to specify any number of file groups using the rtFileGroups property.  Each file group has its own source and destination paths.  Therefore, any files that are copied from and to the same directory should belong in a file group together.  To allow the users to select which file groups to install by using the default Choose File Groups Dialog, include ioChooseFileGroups in the Options property. However, if you do not want the default Choose File Groups Dialog to appear, do not include ioChooseFileGroups in the Options property.  You can attach code to the OnChooseFileGroups event to provide your own dialog.

You specify the number of disks that your installation program will use with the Disks property.  The users will only be asked to enter a new disk if a file cannot be found.  I.e. if your users are installing from a harddrive,.network drive, tape drive, etc... Only those files that cannot be found on the current disk will cause a prompt for entering the appropriate disk number.  The RetryCount property specifies how many times the user will be prompted for entering a disk, if a file cannot be found.  Each time a file cannot be found the OnPromptDisk event will be called.  If a file cannot be found in RetryCount times,  the OnCannotFindFile event will be executed

The OnCopyFile event is called before a a file is actually copied.  You can put code in this event to use other types of copy routines or decompression routines.  If you want to provide your own dialogs for a file being copied, you can specify that the default copy file dialog be turned off by not including the ioShowDefaultCopyDlg in the Options property.  The CompressionType property specifies the default compression method.

The rtWindowGroup property provides information about the group that will be added to the program manager in windows, and all of the program items that you want to go into that group.  You can allow the users to select a window's group, using the default Choose Window Group Dialog, by including the ioChooseWindowGroup in the Options property.  The OnGetWindowGroupName event is called before the user is prompted with the select window group dialog.

The rtAliases property provides information about the aliases that will be added to the BDE.  Similarly the rtRSConnections property provides information about the ReportSmith connections that will be added to ReportSmith.  The OnAddRSConnection event is called when a ReportSmith connection is being added.

The HelpIndexes property allows you to specify help context numbers for the default Choose File Groups Dialog and default Choose Window Group Dialog.

If you specify a file name in the  INIFileName property, a file will automatically created, on the target machine, allows you to specify a file, that contains information about where the various file groups and files were copied to.  This file is used mostly by the TReportManager component.  The INIFileGroup property allows you to specify which file group (in essence which directory), the file will be created in.  I recommend that you specify both an INIFileName and INIFileGroup.  I also recommend that you associate the file with the file group that will contain your main executable.

A call to the Execute method will start the install component rolling.


comp_TRSConnections
TRSConnections Component

Properties	Methods	Exceptions

Unit

  InstDec

Description

The TRSConnections component stores information about the ReportSmith connections that will be added to ReportSmith when the Install component is executed.

Use the Connection property to reference individual ReportSmith connections.  Use the Count property to obtain a count of the ReportSmith connections to be installed.  Use the Add method to add a connection to the list.  Use the Delete method to remove a connection from the list and use the IndexOf method to find the index into the Connection property if you know the name of a connection.


TInstall_PropertiesPopup

Properties

CompressionType

Disks

HelpIndexes

INIFileName

INIFileGroup

 	Options

RetryCount

rtAliases

rtFileGroups

rtRSConnections

rtWindowGroup


TInstall_MethodsPopup

Methods

Execute


Dialog_DefaultWindowGroupChoice
Default Choose Window Group Dialog

This is simply a dialog box I made for the user to select the window group into which the install component will add program items.  Feel free to provide your own dialog box.  To do this attach code to the OnGetWindowGroupName event hander.


prop_TInstallFileGroups
rtFileGroups Property

Applies To

TInstall

Declaration

property rtFileGroups: TFileGroups;

Description

The rtFileGroups property provides information about the various file groups.  Modify this property at run-time only.  Note: This is not a typo!  The FileGroups property that you see on the component editor can only be modified at Design-Time.  In order to change the file groups and files at run-time, you must go through this property.  In essence, they both point to the same data.  However, at run-time you must use this property.


Event_TInstallOnGetWindowGroupName
OnGetWindowGroupName Event

Example

This event is called before the default Choose Window Group Dialog is displayed.


prop_TInstallDisks
Disks property

Applies To

TInstall

Declaration

property Disks: Integer;

Description

You specify the number of disks that your installation program will use by changing the value of the Disks property


prop_TInstallRetryCount
RetryCount Property

Applies To

TInstall

Declaration

property RetryCount: Integer;

Description

The RetryCount property specifies how many times the user will be prompted for entering a disk, if a file cannot be found.


event_TInstallOnCannotFindFile
OnCannotFindFile Event

Example

Applies To

TInstall

Declaration

property OnCannotFindFile: TCannotFindFileEvent;

Description

If a file cannot be found in RetryCount times,  the OnCannotFindFile event will be executed.


Example_TInstallExecute
Execute Example

Since the TInstall component doesn't do anything until it is told, you will want to create a project that will be your install project.  Typically, you might just want a main form that has a nice bitmap or company logo or something.  The next thing you could do is provide a button or something that will run the installation when the user presses it.  In this example, I have a form and a button called BitBtn1.  When the user presses BitBtn1, I want to run the Install component. Of course, If I am going to be installing aliases, I want to either run the BDE Install program or tell the user to do that first.  In this case, I opted to call the BDE install program using the ExecuteFile procedure in FMXUtils.pas files, which is typically found in the \delphi\demos\doc\filmanex directory.

unit Unit1;

interface

uses

  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,

  Forms, Dialogs, StdCtrls, Buttons, Install;

type

  TForm1 = class(TForm)

    Install1: TInstall;

    BitBtn1: TBitBtn;

    procedure BitBtn1Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  Form1: TForm1;

implementation

{$R *.DFM}

uses

  FMXUtils;

procedure TForm1.BitBtn1Click(Sender: TObject);

var

  CurrentDir: String;

begin

  GetDir(0,CurrentDir);

  if MessageDlg('Have you installed the BDE',mtConfirmation,[mbYes,mbNo],0) = mrNo

                                                            then

    ExecuteFile('BDESetup.exe','',CurrentDir,SW_SHOW);

  Install1.Execute;

end;

end.


event_TInstallOnCopyFile
OnCopyFile Event

Example

Applies To

Install

Declaration

property OnCopyFile: TCopyFileEvent;

Description

The OnCopyFile event is called before a file is actually copied.  You can put code in this event to use other types of copy routines or decompression routines.


prop_TInstallWindowGroup
rtWindowGroup property

Applies To

TInstall

Declaration

property rtWindowGroup: TWinGroup;

Description

The WindowGroup property provides information about the program items that will be added to the Program Manager.  Modify this property at run-time only.  Note: This is not a typo!  The WindowGroup property that you see on the component editor can only be modified at Design-Time.  In order to change program items, you must go through this property.  In essence, they both point to the same data.  However, at run-time you must use this property.


prop_TInstallAliases
rtAliases Property

Applies To

TInstall

Declaration

property rtAliases: TAliases;

Description

The rtAliases property provides information about the aliases that will be added to the BDE.  Modify this property at run-time only.  Note: This is not a typo!  The Aliases property that you see on the component editor can only be modified at Design-Time.  In order to change aliases, you must go through this property.  In essence, they both point to the same data.  However, at run-time you must use this property.


prop_TInstallHelpIndexes
HelpIndexes property

Applies To

TInstall

Declaration

property HelpIndexes: THelpIndexes;

Description

The HelpIndexes property allows you to specify help context numbers for the default install type dialog and specify directories dialog.  I.e. when the user hits the help button on the default Choose Groups Dialog, the help file for your application will be called with corresponding HelpIndex number.

To set the Choose Groups Dialog help context at run-time to (Number):

HelpIndexes.hiChooseGroupsDlg := (Number);

To set the Choose Window Group Dialog help context at run-time to (Number):

HelpIndexes.hiChooseWindowGroupDlg := (Number);


event_TInstallOnChooseFileGroups
OnChooseFileGroups Event

Example

Applies To

Install

Declaration

property OnChooseFileGroups: TChooseFileGroupsEvent;

Description

The OnChooseFileGroups event is called before the user is prompted with the default Choose File Groups Dialog.


event_TInstallOnPromptDisk
OnPromptDisk Event

Example

Applies to

Install

Declaration

property OnPromptDisk = TPrompDiskEvent;

Description

Each time a file cannot be found will generate a call to the OnPromptDisk event.


method_TInstallExecute
Execute Method

Example

Applies To

TInstall

Declaration

procedure Execute;

Description

The Execute method starts the installation process.  Because the TInstall component is a delphi component, you can provide any other installation processes before or after you call the Execute method.


TInstall_EventsPopup

Events

OnAddRSConnection

OnCannotFindFile

OnChooseFileGroups

OnCopyFile

OnGetWindowGroupName

OnPromptDisk


Dialog_DefaultFileCopyDialog


type_TInstallCannotFindFileEvent
TCannotFindFileEvent Type

Declaration

type TCannotFindFileEvent = procedure(Sender: TObject;FilePath: String;var Continue: 	Boolean) of Object;

Description

To tell the Install component NOT to display a message, in your event handling code, set Continue to False.  The file that Install is trying to copy is held in the


type_TInstallOnCopyEvent
TOnCopyEvent Type

Declaration

type TCopyEventType = procedure(Sender: TObject;FilePath,ToDir: String;var Continue:

 	Boolean;PercentDone: Integer) of Object

Description

Setting continue to False allows you to override the default file copy routines of the TInstall component.  FilePath holds the complete path and filename of the file being copied.  ToDir holds the destination path for the file being copied.  PercentDone holds the percentage of the files that have been copied out of the total to be copied.


type_TInstallGetDirectoriesEvent
TChooseFileGroupsEvent  Type

Declaration

type TChooseFileGroupsEvent= procedure(Sender: TObject;var Continue: Boolean) of Object;

Description

Set Continue to False to disallow TInstall component from displaying the Choose File Groups Dialog.  This allows you to provide your own directory selection dialog box.


prop_TInstallINIFileName
INIFileName Property

Applies To

TInstall

Declaration

property INIFileName: String;

Description

If you specify a file name in the  INIFileName property, a file will automatically created, on the target machine, allows you to specify a file, that contains information about where the various file groups and files were copied to.  This file is used mostly by the TReportManager component.  You must specify a INIFileGroup if you are going to use this property.


prop_TInstallINIFileGroup
INIFileGroup Property

Applies To

TInstall

Declaration

property INIFileGroup: String;

Description

The INIFileGroup property allows you to specify which file group (in essence which directory), the file will be created in.  I recommend that you specify both an INIFileName and INIFileGroup.  E.g. if the INIFileName is 'myapp.ini' and it is associated with the file group 'program', which gets installed to the 'c:\myapp\program' on the target machine, then a 'c:\myapp\program\myapp.ini' file will be created on the target machine.


type_TInstallPromptDiskEvent
TPromptDiskEvent Type

Declaration

type TPromptDiskEvent = procedure(Sender: TObject;DiskNumber: Integer;var Continue: Boolean) of  Object;

Description

Set Continue to False to prevent the TInstall component from displaying the default enter disk dialog box.


Dialog_DefaultFileGroupChoice
Default Choose File Groups Dialog

This dialog simply presents the user with a dialog box that I made.  Feel free to provide your own dialog box.  You can do this by attaching code to the OnChooseFileGroups event handler.


prop_TInstallCompressionType
CompressionType Property

Applies To

TInstall

Declaration

property CompressionType: TCompressionType;

Description

This tells the TInstall component what type of compression to use when copying the files from the sources to the destinations.  Of course, you can provide custom copying by attaching code to the OnCopyFile event.


type_TInstallCompression
TCompressionType type

Declaration

TCompressionType = (ctNone,ctWinCompress);

Description

ctNone denotes no compression.  I.E. the files will be copied.

ctWinCompress tells the TInstall component that the files were compressed using Compress.exe.  If you choose this type of compression, then the TInstall component will attempt to expand the files when it is copying them.  This is done automatically, you DO NOT have to include EXPAND.EXE with your files.


componentHelp_Aliases
Aliases Property Editor

This property editor allows you to modify the rtAliases property, which points to a component of type TAliases.  Each alias, of type TAliasItem, is owned by this component.  You are essentially editing the various properties of each alias with this property editor.

You specify any number of aliases to install on the target machine using this dialog.  If you have not yet defined any aliases, you must hit the Add button.  Then you must specify the name of the alias.  The Name edit box allows you to do this (it is hooked to the Name property).  This name will be the name that is added to the target machine's BDE.

The next step is to define the alias driver type.  ASCII, DBase, and Paradox drivers allow you to define a path (on the target machine) to data files, and the SQL driver allows you to define Parameters.  The driver combo box lets you do this (it is hooked to the Driver property)

The Path edit box (hooked to the Path property) and FileGroup combobox (hooked to the FileGroup property) are only valid for the ASCII, DBase, and Paradox driver types.  In the Path edit box, you may enter a hard-coded path for the alias.

The Params edit box (hooked to the SQLParams property) is only valid for SQL drivers.  In this edit box, you specify the BDE parameters for the SQL driver.


componentHelp_Files
FileGroups Property Editor

This property editor allows you to modify the rtFileGroups property, which points to a component of type TFileGroups.  Each file group, of type TFileGroup, is owned by this component.  In this property editor you are editing the files that are owned by each file group.  Each file is of type TFileItem.

Each file group has different files that are associated to different disks.  This way you can have files that belong to the same file group spread out.  You can switch to different file groups by using the listbox on the right side of the dialog box.  To switch between the different disks, use the < and > buttons at the top.  You can browse your disks and directories for files that you will have on the various disks at the time that your user runs the install app.  Note:  This does not copy the files for you.


componentHelp_WindowGroupDialog
WindowGroup Property Editor

This property editor allows you to modify the rtWindowGroup property, which points to a component of type TWinGroup.  Each alias, of type TProgramItem, is owned by this component.  You are essentially editing the various properties of each program item with this property editor.

The Command Line edit box is linked to the CommandLine property and the Description edit box is linked to the Description property.  The Name edit box is linked to the Name property of the TWinGroup.  Note:  If there are no program items, you cannot specify a name for the Window Group.


comp_TFileGroups
TFileGroups component

properties	methods	exceptions

Unit

  InstDec

Description

The TFileGroups component is essentialy a data structure component that holds information about the various file groups that you will use in the installation.  You can access the various file groups through various methods and properties of the TFileGroups component.

The Count property contains the number of file groups being maintained.  This property is usefull for iterating through the file groups.  The FileGroup property allows access to an individual file group.  The NumberOfDefaultGroups property contains a count of the number of file groups that are marked as default, at run-time.

Use the Add method to add a file group.  You cannot have duplicate file group names.  Use the DeleteGroup method delete a file group.  If you want to delete all the files for a particular disk, use the DeleteForDisk method.  To get a list of all the files for all the groups, use the FileNames method.  For a list of the groups, use the GroupNames method.  To get a list of all groups that are marked as a default group, use the DefaultGroups method.  For a list of all groups that are NOT marked as a default group, use the NotDefaultGroups method.

To reference a particular file group, you must know its index.  To find the index of a file group if you have the file group's name, use the IndexOf method.

The ExpandFileNames method takes a string and replaces any occurences of a file name, that is enclosed in parenthesis, with the full path of the file as it will be on the target machine.  This method is very usefull, because you can never be sure where the different file groups will be installed to.


comp_TFileGroup
TFileGroup Component

properties	methods	exceptions

The TFileGroup component is essentialy a data structure component that holds information about the various files that you will use in the installation.  You can access the various files through various methods and properties of the TFileGroup component.

The Count property stores the number of files.  The Name property holds the name of the file group as it appears both internally and to the users.

The DefaultSourceDir holds information about where the file group will be installed from, while the DefaultDestDir holds information about where the file group will be installed to.  The Description property contains information about the file group that is displayed on the default Choose File Groups Dialog box.  The IsDefault property determines whether the file group will be installed.

Use the FileItems property to access an individual file of the group.  To add a file to the FileItems property, use the AddFile access method.  To delete a file use the DeleteFile method.  Use the FileNames method to obtain a list of all the files owned by the file group.  The DiskFiles method returns a list of all files for a particular disk.  Use the DeleteForDisk method to clear all the files for a particular group.  Use the IndexOf method to obtain the index number for a particular file.  To clear all the files use the ClearFiles method.


prop_TFileGroupsCount
Count Property

Applies  to

TFileGroups component

Declaration

function Count: Integer;

Description

The Count property specifies the number of file groups.


prop_TFileGroupsFileGroup
FileGroup property

Applies  to

TFileGroups component

Declaration

property FileGroup[Index: Integer]: TFileGroup;

Description

The FileGroup property holds information about each individual file group.  Note: this property is run-time only.


prop_TFileGroupsNumberOfDefaultGroups
NumberOfDefaultGroups

Applies  to

TFileGroups component

Declaration

property NumberOfDefaultGroups: Integer;

Description

The NumberofDefaultGroups property holds the number of file groups that are marked as  a default group.


method_TFileGroupsAdd
Add Method

Example

Applies  to

TFileGroups component

Declaration

function Add(Name: String): Integer;

Description

The add method adds a new group to the FileGroup array.  The add method raises the EDuplicateGroupName exception if Name is found in the existing FileGroup array.  The add method returns the index of the newly added group in the FileGroup array.


method_TFileGroupsDeleteGroup
DeleteGroup Method

Example

Applies  to

TFileGroups component

Declaration

procedure DeleteGroup(Value: Integer);

Description

The DeleteGroup deletes a group, specified by Value, in the FileGroup property.


method_TFileGroupsDeleteForDisk
DeleteForDisk

Example

Applies  to

TFileGroups component

Declaration

procedure DeleteForDisk(Value: Integer);

Description

The DeleteForDisk method deletes all files that correspond to the disk specified by Value.


method_TFileGroupsFileNames
FileNames Method

Example

Applies  to

TFileGroups component

Declaration

procedure FileNames(Value: TStrings);

Description

The FileNames method returns a list of all file names for all the file groups.  All data in Value will be cleared.


method_TFileGroupsGroupNames
GroupNames Method

Example

Applies  to

TFileGroups component

Declaration

procedure GroupNames(Value: TStrings);

Description

The GroupNames method puts all of the names of all of the file groups into Value.  All data in Value will be cleared.


method_TFileGroupsIndexOf
IndexOf Method

Example

Applies  to

TFileGroups component

Declaration

function IndexOf(Value: String): Integer;

Description

The IndexOf method returns the index into the FileGroup property of the group with name equal to Value.


method_TFileGroupsDefaultGroups
DefaultGroups Method

Example

Applies  to

TFileGroups component

Declaration

procedure DefaultGroups(Value: TStrings);

Description

The DefaultGroups methods returns the names of all groups that are marked as a default group.  All data in Value will be cleared by the DefaultGroups method.

.


method_TFileGroupsNotDefaultGroups
NotDefaultGroups Method

Example

Applies  to

TFileGroups component

Declaration

procedure NotDefaultGroups(Value: TStrings);

Description

The NotDefaultGroups method places the names of all the groups that are NOT marked as default groups into Value.  All data in Value will be cleared.


method_TFileGroupsExpandFileNames
ExpandFileNames Method

Example

Applies  to

TFileGroups component

Declaration

procedure ExpandFileNames(var S: String);

Description

Use this method to replace all occurrences of file names, that are enclosed in parenthesis, with their corresponding destination path.  This is necessary because you do not know where the files will be copied if you allow the user to change directories.  For example, if you want to add a program item that is a help file you must call winhelp as follows:

winhelp.exe filename

By enclosing filename in parenthesis, you can expand the filename into its full path.

Example.

winhelp.exe (filename) --Expanded at run-time--> winhelp.exe c:\finaldir\filename


TFileGroups_PropertiesPopup

Properties

Count

FileGroup

NumberOfDefaultGroups


TFileGroups_MethodsPopup

Methods

Add

DefaultGroups

DeleteForDisk

DeleteGroup

ExpandFileNames

FileNames

GroupNames

IndexOf

NotDefaultGroups


example_TFileGroupsAddMethod
Add Example

This demonstrates adding a file group to the list of file groups.  The following example will add only two groups because an exception will be raised when you add the third group.  This is because there is already a group with the name 'group1'.  Typically, you will not create your own instantiation of the FileGroups class.  It only really makes sense to access the rtFileGroups property of the TInstall component to play with the various filegroups and files.

uses

  InstDec;

procedure MyAddProcedure;

var

  FileGroups: TFileGroups;

  IndexOfNew: Integer;

begin

  FileGroups := TFileGroups.Create(Self);

  try

    FileGroups.Add('Group1');

    IndexOfNew := FileGroups.Add('Group2');

    FileGroups.FileGroup[IndexOfNew].IsDefault := True;

    FileGroups.Add('Group1');

  except

    on E: EDuplicateGroupName do

      MessageDlg('Duplicate Name! Oops.',mtError,[mbOk],0);

  end;

end;


exception_TFileGroupsEDuplicateGroupName
EDuplicateGroupName Exception

Applies  to

TFileGroups component

Declaration

EDuplicateGroupName = class(Exception);

Description

The EDuplicateGroupName exception will be raised if you attempt to add a group that has the same name as another group.


example_TFileGroupsDefaultGroupsMethod
DefaultGroups Example

This examples show how to obtain a list of all the groups that are marked as a default group.  This example assumes that you have an install component named install1.  This code snippit simply skips through all the file groups and puts a messagebox on the screen with the groups name and index.

var

  DefaultGroupList: TStringList;

  i: Integer;

begin

  DefaultGroupList := TStringList.Create;

  try

    Install1.rtFileGroups.DefaultGroups(DefaultGroupList);

    for i := 0 to DefaultGroupList.Count-1 do

      MessageDlg('FileGroup #' + IntToStr(i) + ' is called: ' +

          DefaultGroupList[I],mtInformation,[mbOk],0);

  except

    DefaultGroupList.Free;

  end;

end;


example_TFileGroupsDeleteForDiskMethod
DeleteForDisk Example

This code snippit shows an example of deleting all the files for a particular disk.  If the disk is not defined, it simply does not delete any files.  In essence, the DeleteForDisk method calls the DeleteForDisk method of all the file groups in the FileGroup property.

begin

  Install1.rtFileGroups.DeleteForDisk(1);

end;


example_TFileGroupsDeleteGroupMethod
DeleteGroup Example

This code snippit shows an example of deleting a group by using its index in the FileGroup property and by using the IndexOf method to return the index of a particular file group.

with Install1.rtFileGroups do begin

  DeleteGroup(0);

  DeleteGroup(IndexOf('Group1'));

end;


Example_TFileGroupsExpandFileNamesMethod
ExpandFileNames Example

The ExpandFileNames method is an invaluable run-time tool.  Take an example as simple as trying to put a program item in the client's program manager that runs a help system.  Since you do not know, at design-time, where the help file will eventually be located (unless you disallow the user from choosing file groups by modifying the Options property of the install component), you cannot hard code the command line.  Because the install component does not install program items until all the files have been copied to the client's machine, you can expand a filename into its full path by putting parenthesis around it.  For example, if the install.hlp file was copied to the c:\tinstall directory of your machine, then calling 'winhelp.exe (install.hlp)' will be expanded to 'winhelp.exe c:\tinstall\install.hlp'.

var

  RunTimeCommandLine: String;

begin

  RunTimeCommandLine := 'winhelp.exe (install.hlp)';

  with Install1.rtFileGroups do

    ExpandFileNames(RunTimeCommandLine);

  MessageDlg(RunTimeCommandLine,mtInformation,[mbOk],0);

end;


Example_TFileGroupsFileNamesMethod
FileNames Example

This code snippit lists all the files for all the groups.  Essentially the FileNames method goes through each file group in the FileGroup property and calls its FileNames method.

var

  FileNames: TStringList;

  i: Integer;

begin

  FileNames := TStringList.Create;

  try

    Install1.rtFileGroups.FileNames(FileNames);

    for i := 0 to FileNames.Count-1 do

      MessageDlg(FileNames[I],mtInformation,[mbOk],0);

  except

    FileNames.Free;

  end;

end;


Example_TFileGoupsGroupNamesMethod
GroupNames Example

This code snippit lists all the names of all the groups.  Essentially the GroupNames method goes through each file group in the FileGroup property.

var

  GroupNames: TStringList;

  i: Integer;

begin

  GroupNames := TStringList.Create;

  try

    Install1.rtFileGroups.GroupNames(GroupNames);

    for i := 0 to GroupNames.Count-1 do

      MessageDlg(GroupNames[I],mtInformation,[mbOk],0);

  except

    GroupNames.Free;

  end;

end;


Example_TFileGroupsIndexOfMethod
IndexOf Example

This code snippit shows how to delete a group by calling the IndexOf method to return the index of the file group in the FileGroup property.

with Install1.rtFileGroups do begin

  DeleteGroup(IndexOf('Group1'));

end;


Example_TFileGroupsNotDefaultGroupsMethod
NotDefaultGroups Example

This examples show how to obtain a list of all the groups that are NOT marked as a default group.  This example assumes that you have an install component named install1.  This code snippit simply skips through all the file groups and puts a messagebox on the screen with the groups name and index.

var

  NotDefaultGroupList: TStringList;

  i: Integer;

begin

  NotDefaultGroupList := TStringList.Create;

  try

    Install1.rtFileGroups.NotDefaultGroups(NotDefaultGroupList);

    for i := 0 to NotDefaultGroupList.Count-1 do

      MessageDlg('FileGroup #' + IntToStr(i) + ' is called: ' +

          NotDefaultGroupList[I],mtInformation,[mbOk],0);

  except

    NotDefaultGroupList.Free;

  end;

end;


TFileGroups_ExceptionPopup

Exceptions

EDuplicateGroupName


TFileGroup_PropertiesPopup

Properties

Count

DefaultDestDir

DefaultSourceDir

Description

FileItems

IsDefault

Name


TFileGroup_MethodsPopup

Methods

AddFile

ClearFiles

DeleteForDisk

DeleteFile

DiskFiles

FileNames

IndexOf


TFileGroup_ExceptionPopup

Exception

EDuplicateFileName


prop_TFileGroupCount
Count Property

Applies  to

TFileGroup component

Declaration

property  Count: Integer;

Description

The Count property specifies the number of files owned by the group.


prop_TFileGroupName
Name Property

Applies  to

TFileGroup component

Declaration

property Name: String;

Description

The Name property holds the name of the file group.


prop_TFileGroupDefaultSourceDir
DefaultSourceDir Property

Applies  to

TFileGroup component

Declaration

property DefaultSourceDir: String;

Description

The DefaultSourceDir property specifies where the file group will be installed from.  If you leave this blank then it will be replaced by the path that the users are running your installation application from.  E.g. if they are running your install app from a:\ and you leave DefaultSourceDir blank, then  DefaultSourceDir will be replaced by 'a:\'.

If DefaultSourceDir has a drive specification in it, then DefaultSourceDir will not change.

If DefaultSourceDir specifies a path beginning with \, then DefaultSourceDir will be replaced with the drive that your users are running your install app from followed by DefaultSourceDir.  E.g. if they are running your install app from 'a:\install' and the value of DefaultSourceDir was '\data', then DefaultSourceDir will be replaced by 'a:\data'.

If DefaultSourceDir specifies a path without a leading \, then DefaultSourceDir will be replaced with the current path that your users are running from followed by DefaultSourceDir.  E.g. if they are running your install app from 'a:\install' and the value of DefaultSourceDir was 'data', then DefaultSourceDir will be replaced by 'a:\install\data'.


prop_TFileGroupDefaultDestDir
DefaultDestDir property

Applies  to

TFileGroup component

Declaration

property DefaultDestDir: String;

Description

The DefaultDestDir property specifies where the file group will be installed to.


prop_TFileGroupDescription
Description Property

Applies  to

TFileGroup component

Declaration

property Description: TStrings;

Description

The Description property stores information about the file group.  This is used by the default choose group dialog presented to the user.  However, if you use your own choose group dialog, you can display information about the file group.


prop_TFileGroupIsDefault
IsDefault Property

Applies  to

TFileGroup component

Declaration

property IsDefault: Boolean;

Description

The IsDefault property specifies whether or not the file group should be included in the installation, by default.  This is mainly used by the default choose groups dialog.  However, you may use this anyway you like if you provide your own choose groups dialog.


prop_TFileGroupFileItems
FileItems Property

Applies  to

TFileGroup component

Declaration

property FileItems[Index: Integer]: TFileItem;

Description

The FileItems property allows you to access individual files of the file group.


method_TFileGroupAddFile
AddFile Method

Example

Applies  to

TFileGroup component

Declaration

function AddFile(FileName: String;TheDisk: Integer): Integer;

Description

The AddFile method adds a file for the disk, specified by TheDisk, to the list of files owned by the file group.  The AddFile method returns the index of the added file in the FileItems property.


method_TFileGroupDeleteFile
DeleteFile Method

Example

Applies  to

TFileGroup component

Declaration

procedure DeleteFile(FileName: String;TheDisk: Integer);

Description

The DeleteFile method deletes the give FileName for the given disk, specified by TheDisk.


method_TFileGroupFileNames
FileNames Method

Example

Applies  to

TFileGroup component

Declaration

procedure FileNames(Value: TStrings);

Description

The FileNames method clears Value and fills it with the names of all the files owned by the file group.


method_TFileGroupDiskFiles
DiskFiles Method

Example

Applies  to

TFileGroup component

Declaration

procedure DiskFiles(Value: TStrings;TheDisk: Integer);

Description

The DiskFiles method clears Value and fills it with the names of all the files on the disk, specified by TheDisk.


method_TFileGroupDeleteForDisk
DeleteForDisk Method

Example

Applies  to

TFileGroup component

Declaration

function DeleteForDisk(Value: Integer);

Description

The DeleteForDisk removes all the files owned by the file group that belong to the disk specified by Value.


method_TFileGroupIndexOf
IndexOf Method

Example

Applies  to

TFileGroup component

Declaration

function IndexOf(Value: String): Integer;

Description

The IndexOf method returns the index of the file name, specified by Value, in the FileItems property.  If it cannot find the file, the IndexOf method will return -1.


method_TFileGroupClearFiles
ClearFiles Method

Example

Applies  to

TFileGroup component

Declaration

procedure ClearFiles;;

Description

The ClearFiles method clears all the files owned by the file group for all disks.


Example_TFileGroupAddFileMethod
AddFile Example

This code shows an example of adding a file to the first file group.  This file is marked for disk #1.

with Install1 do begin

  rtFileGroups[0].AddFile('install.hlp',1);

  rtFileGroups[0].AddFile('instdec.dcu',1);

end;


Example_TFileGroupClearFilesMethod
ClearFiles Example

This code snippit goes through all the file groups and clears the file group of all files.

var

  I: Integer;

begin

  with Install1.rtFileGroups do begin

    for I := 0 to Count do

      FileGroup[I].ClearFiles;

  end;

end;


Example_TFileGroupDeleteForDisk
DeleteForDisk Example

This code goes through all the file groups and deletes the files for disk #1.  Note: There is an easier way to do this by calling the DeleteForDisk method of the TFileGroups component.

var

  I: Integer;

begin

  with Install1.rtFileGroups do begin

    for I := 0 to Count do

      FileGroup[I].DeleteForDisk(1);

  end;

end;


Example_TFileGroupDeleteFileMethod
DeleteFile Example

This deletes any file from disk #1 with the name 'install.hlp'.

var

  I: Integer;

begin

  with Install1.rtFileGroups do begin

    for I := 0 to Count do

      FileGroup[I].DeleteFile('install.hlp',1);

  end;

end;


Example_TFileGroupDiskFiles
DiskFiles Example

This example lists all of the files for disk #1 that belong to file group #0.

var

  DiskFiles: TStringList;

  I: Integer;

begin

  DiskFiles := TStringList.Create;

  try

    Install1.rtFileGroups.FileGroup[0].DiskFiles(DiskFiles,1);

    for I := 0 to DiskFiles.Count-1 do

      MessageDlg(DiskFiles[I],mtInformation,[mbOk],0);

  except

    DiskFiles.Free;

  end;

end;


Example_TFileGroupFileNamesMethod
FileNames Example

This example lists all of the files for file group  #0.

var

  Files: TStringList;

  I: Integer;

begin

  Files := TStringList.Create;

  try

    Install1.rtFileGroups.FileGroup[0].FileNames(Files);

    for I := 0 to Files.Count-1 do

      MessageDlg(Files[I],mtInformation,[mbOk],0);

  except

    Files.Free;

  end;

end;


Example_TFileGroupIndexOfMethod
IndexOf Example

This example prints a message if the file 'install.hlp' cannot be found in file group #0.  Note that IndexOf returns -1 if it cannot find the file.

with Install1.rtFileGroups[0] do

  if IndexOf('install.hlp') = -1 then

    MessageDlg('Cannot find install.hlp',mtInformation,[mbOk],0);


comp_TFileItem
TFileItem Object

properties

The TFileItem Object is used to store information about an individual installation file.  The two pieces of information that the TFileItem contains: Name and Disk.


TFileItem_PropertiesPopup

Properties

Disk

Name


prop_TFileItemName
Name Property

Applies  to

TFileItem component

Declaration

property Name: String;

Description

The Name property contains the name of the file.


prop_TFileItemDisk
Disk Property

Applies  to

TFileItem component

Declaration

property Disk: Integer;

Description

The Disk property specifies the disk that the current file is assigned to.


comp_TAliases
TAliases Component

properties	methods	exceptions

Unit

  InstDec

Description

The TAliases component stores information about the aliases that will be added to the BDE when the Install component is executed.

The Alias property holds information about the individual aliases.  The Count property is the number of aliases.  Use the Add method to add an alias.  The Delete method allows you to delete an alias from the list of aliases.  The IndexOf allows you find the index of an alias by sending it an alias name.


prop_TAliasesAlias
Alias Property

Applies  to

TAliases component

Declaration

property Alias[Index: Integer]: TAliasItem;

Description

The Alias property allows access to each individual alias.


method_TAliasesAdd
Add Method

Example

Applies  to

TAliases component

Declaration

function Add(Name: String): Integer;

Description

The Add allows you to add a new alias with the name specified by Name.


method_TAliasesDelete
Delete Method

Example

Applies  to

TAliases component

Declaration

procedure Delete(Index: Integer);

Description

The Delete method deletes the specified alias in the Alias property.


method_TAliasesIndexOf
IndexOf Method

Example

Applies  to

TAliases component

Declaration

function IndexOf(Name: String): Integer;

Description

The IndexOf method returns the index of the alias with name equal to Name in the Alias property.


prop_TAliasesCount
Count Property

Applies  to

TAliases component

Declaration

property Count: Integer;

Description

The Count property holds the number of aliase owned by TAliases.


TAliases_PropertyPopup

Properties

Alias

Count


TAliases_MethodPopup

Methods

Add

Delete

IndexOf


Example_TAliasesAddMethod
Add Example

This code snippit adds a new alias and then assigns a hard-code path to the alias.  Note: if there is already an alias in the BDE with the name 'NewAlias', then the EDuplicateAliasName exception will be raised.

var

  NewIndex: Integer;

begin

  with Install1 do begin

    try

      NewIndex := rtAliases.Add('NewAlias');

      rtAliases[NewIndex].Path := 'c:\data';

    except

      on E: EDuplicateAliasName do

        MessageDlg('NewAlias is already in the BDE',mtError,[mbOk],0);

    end;

  end;

end;


Example_TAliasesDeleteMethod
Delete Example

This example simply deletes an alias named 'OldAlias', then it goes through the rest of the Aliases and deletes them.  Note that it is convenient to use the IndexOf method to get the index into the Alias property if you only have the name of the alias.

var

  i: Integer;

begin

  with Install1 do begin

    rtAliases.Delete(rtAliases.IndexOf('OldAlias'));

    for i := rtAliases.Count-1 to 0 do

      rtAliases.Delete(i);

  end;

end;


Example_TAliasesIndexOfMethod
IndexOf Example

This example simply deletes an alias named 'OldAlias', then it goes through the rest of the Aliases and deletes them.  Note that it is convenient to use the IndexOf method to get the index into the Alias property if you only have the name of the alias.

var

  i: Integer;

begin

  with Install1 do begin

    rtAliases.Delete(rtAliases.IndexOf('OldAlias'));

    for i := rtAliases.Count-1 to 0 do

      rtAliases.Delete(i);

  end;

end;


comp_TAliasItem
TAliasItem Component

properties	exceptions

The TAliasItem holds information about an individual alias that will be added to the BDE by the Install component.

The Name property holds the name of the alias, as it will appear on the destination machine's idapi.cfg.  The Driver holds the name of the driver for the alias.

For standard aliases (e.g. driver types of ASCII, DBase, or Paradox), you can optionally specify a hard-coded path for the alias with the Path property.  You can also associate an alias with a file group using the FileGroup property.  This is useful because you might not know where your data files will copied, when the user runs your installation program.  You cannot specify both a hard-coded path and a file group.

For an SQL type alias, the SQLParams property allows you to specify certain attributes of the alias.


prop_TAliasItemName
Name Property

Applies  to

TAliasItem component

Declaration

property Name: String;

Description

The Name property is the name of the alias, as it will appear in the destination machine's idapi.cfg.


prop_TAliasItemDriver
Driver Property

Applies  to

TAliasItem component

Declaration

property Driver: String;

Description

The Driver property specifies the driver type for the alias.  The driver can be either 'ASCII','DBase','Paradox', or 'SQL'.


prop_TAliasItemPath
Path Property

Applies  to

TAliasItem component

Declaration

property Path: String;

Description

The Path property allows you to provide a hard-coded path for the alias.  You should avoid setting a hard-coded path, unless you know the exact setup of the destination system.


prop_TAliasItemFileGroup
FileGroup Property

Applies  to

TAliasItem component

Declaration

property FileGroup: String;

Description

The FileGroup property allows you to associate an alias with a file group.  For instance, if you have a file group that contains data tables, you might want to install an alias to point to that file group's path.


prop_TAliasItemSQLParams
SQLParams Property

Applies  to

TAliasItem component

Declaration

property SQLParams: String;

Description

The SQL params property allows you to specify file stuff!


TAliasItem_PropertiesPopup

Properties

Driver

FileGroup

Name

Path

SQLParams


comp_TWinGroup
TWinGroup Component

properties	method

Unit

  InstDec

Description

The TWinGroup component stores information about the program items that you are going to install into the window group specified by the Name property.  The ProgramItem property allows you to access individual program items.  Use the Count property to get the number of program items.

Use the Add property to add a program item, and Delete to delete a program item.


prop_TWinGroupName
Name Property

Applies  to

TWinGroup component

Declaration

property Name: String;

Description

The Name property specifies the name of the windows group to put the program items into.


Example_TInstallBDEInstall
BDE Install Example

This example assumes you have renamed the BDE setup.exe program to BDEInst.exe.

This also assumes that you have a button called btnInstallBDE on your form.  When you press the button, it will ask you to put in the disk with BDEInst.exe  and then it will run the BDE Install program.  On the form I also assume you have a button called btnInstallMyStuff.  When the BDE Install gets done, if the user clicks on the InstallMyStuff button, it will start setting up your stuff.  Note: This is very ugly and not hugely graceful.  I can think of a lot better interface.  However, the reason for making you call the BDE Install is two-fold.  It is very simple and you can tell your users exactly what is going to happen to them.  The procedure is exactly the same for ReportSmith.

unit Unit1;

interface

uses

  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,

  Forms, Dialogs, StdCtrls, Buttons, Install;

type

  TForm1 = class(TForm)

    Install1: TInstall;

    btnInstallBDE: TButton;

    btnInstallMyStuff: TButton;

    procedure btnInstallBDEClick(Sender: TObject);

    procedure btnInstallMyStuffClick(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  Form1: TForm1;

implementation

{$R *.DFM}

uses

  FMXUtils;  { usually found in \delphi\demos\doc\filmanex }

procedure TForm1.btnInstallBDEClick(Sender: TObject);

var

  CurrentDir: String;

begin

  if MessageDlg('Insert Disk with BDEInst.exe',mtInformation,[mbOk],0) = mrOk then begin

    GetDir(0,CurrentDir);

    ExecuteFile('BDEInst.exe','',CurrentDir,SW_SHOW);

  end;

end;

procedure TForm1.btnInstallMyStuffClick(Sender: TObject);

begin

  if MessageDlg('Insert the Disk with My Install App',mtInformation,[mbOk],0) = mrOk then

    Install1.Execute;

end;

end.


prop_TWinGroupProgramItem
ProgramItem Property

Applies  to

TWinGroup component

Declaration

property ProgramItem[Index: Integer]: TProgramItem;

Description

The ProgramItem property allows access to the individual program items.


prop_TWinGroupCount
Count Property

Applies  to

TWinGroup component

Declaration

property Count: Integer;

Description

The Count property holds the number of program items.


method_TWinGroupAdd
Add Method

Example

Applies  to

TWinGroup component

Declaration

function Add: Integer;

Description

The Add function adds a new program item to the list of program items owned by the TWinGroup component.  The list of program items can be accessed through the ProgramItem property.


method_TWinGroupDelete
Delete Method

Example

Applies  to

TWinGroup component

Declaration

procedure Delete(Index: Integer);

Description

The Delete method deletes the program item specified by Index.


Exception_TFileGroupEDuplicateFileName
EDuplicateFileName Exception

Applies  to

TFileGroup component

Declaration

EDuplicateFileName = class(Exception);

Description

This exception is raised when you try to add a file to a group that has the same name as some other file in the group.


Exception_TAliasItemEFileGroupNotFound
EFileGroupNotFound Exception

Applies  to

TAliasItem component

Declaration

EFileGroupNotFound = class(Exception);

Description

This exception is raised when you try to assign a filegroup to the FileGroup property that is not yet defined.


Exception_TAliasItemEDriverTypeNotSupported
EDriverTypeNotSupported Exception

Applies  to

TAliasItem component

Declaration

EDriverTypeNotSupported = class(Exception);

Description

This exception is raised when you try to assign a driver type other than ASCII, DBase, Paradox, or SQL.


TWinGroup_PropertiesPopup

Properties

Count

Name

ProgramItem


Example_TWinGroupAdd
Add Example

This example shows adding a Program Item.  Note the parenthesis around the (install.hlp); this will be expanded to the full path name (using the ExpandFileNames method) of the enclosed file when the install component installs the program items.

var

  NewIndex: Integer;

begin

  with Install1 do begin

    NewIndex := rtWindowGroup.Add;

    rtWindowGroup[NewIndex].CommandLine := 'winhelp.exe (install.hlp)';

    rtWindowGroup[NewIndex].Description := 'Install Help';

  end;

end;


Example_TWinGroupDeleteMethod
Delete Example

This example deletes all of the program items that you are going to install.

var

  i: Integer;

begin

  with Install1 do begin

    for i := rtWindowGroup.Count-1 downto 0 do

      rtWindowGroup.Delete(I);

  end;

end;


TWinGroup_MethodPopup

Methods

Add

Delete


comp_TProgramItem
TProgramItem Component

properties

The TProgramItem component holds information about each individual program item.  There are essentially two things to the TProgramItem component, the CommandLine property and the Description property.

When the program items are being installed by the Install component, the CommandLine property will become the command line of the program item.  The Description property will become the name of the program item as it appears on your windows system.


prop_TProgramItemCommandLine
CommandLine Property

Applies  to

TProgramItem component

Declaration

property CommandLine: String;

Description

The CommandLine property will become the command line of the program item.  When the install component goes to install the program items, the CommandLine will be expanded using the ExpandFileNames method of the TFileGroups component.  This allows you to avoid using hard-coded command lines.


prop_TProgramItemDescription
Description Property

Applies  to

TProgramItem component

Declaration

property Description: String;

Description

When the install component installs the program item, the description property will be used as the name of the program item, as it appears in the program manager.


TProgramItem_PropertiesPopup

Properties

CommandLine

Description


component_HelpFileGroups
FileGroups Property Editor

This property editor allows you to modify the rtFileGroups property, which points to a component of type TFileGroups.  Each file group, of type TFileGroup, is owned by this component.  You are essentially editing the various properties of each file group with this property editor.

The IsDefault edit box is linked to the IsDefault property.  The Description memo is linked to the Description property.  The Source edit box is linked to the DefaultSourceDir property.  The Destination edit box is linked to the DefaultDestDir property and the Name edit box is linked to the Name property.


Example_TInstallOnChooseFileGroupsEvent
OnChooseFileGroupsEvent Example

This example shows how you would override my default Choose File Group Dialog.  Note that you can display your own stuff plus my stuff by setting Continue to True.

procedure TForm1.Install1ChooseFileGroups(Sender: TObject;

  var Continue: Boolean);

var

  I: Integer;

  InstallGroups: TStringList;

begin

  with Install1.rtFileGroups do begin

    if MessageDlg('Do You want all groups to be

 	 default?',mtInformation,[mbYes,mbNo],0) = mrYes then

      for I := 0 to Count-1 do

        FileGroup[I].IsDefault := True;

    InstallGroups := TStringList.Create;

    try

      DefaultGroups(InstallGroups);

      for I := 0 to InstallGroups.Count-1 do

        MessageDlg('Going to install group: '+

 	 InstallGroups[I],mtInformation,[mbOk],0);

    finally

      InstallGroups.Free;

    end;

  end;

  Continue := False;


Example_TInstallOnCannotFileFileEvent
OnCannotFindFileEvent Example

This gives you an example of how you would override my default handling when the Install component is having problems copying the file.  Note that you can display your own stuff and still display my default dialog.  If you want to disallow displaying my default dialog set Continue to false.  Also notice the EQuitOut exception.  If you raise this, the Install component does not continue the installation process.

uses

  InstDec;

procedure TForm1.Install1CannotFindFile(Sender: TObject; FilePath: String;

  var Continue: Boolean);

begin

  MessageDlg('This Is My Own Cannot Find File Dialog',mtInformation,[mbOk],0);

  MessageDlg('I cannot find the file ' + FilePath,mtInformation,[mbOk],0);

  if MessageDlg('Display the default cannot find file dialog',

                         mtInformation,[mbYes,mbNo],0) = mrNo then

    Continue := False

  else

    if MessageDlg('O.k. then, would you like to quit',mtInformation,

                          [mbYes,mbNo],0) = mryes then

        raise EQuitOut.Create('');

end;


Example_TInstallOnCopyFileEvent
OnCopyFileEvent Example

This example show how to use your own compression routines.  Of course, you can do other stuff here also, like show a custom dialog or something.

uses

  InstDec,

  FMXUtils;  { Usually in \delphi\demos\doc\filmanex }

procedure TForm1.Install1CopyFile(Sender: TObject; var FilePath,

  ToDir: OpenString; var Continue: Boolean; PercentDone: Integer);

var

  CurrentDir: String;

begin

  GetDir(0,CurrentDir);

  ExecuteFile('pkunzip.exe',FilePath + ToDir,CurrentDir,SW_SHOWMINIMIZED);

  MessageDlg('We are ' + IntToStr(PercentDone) + '% done',mtInformation,[mbOk],0);

  Continue := False;

end;


Example_TInstallOnGetWindowGroupNameEvent
OnGetWindowGroupNameEvent Example

This example shows how to override my default Choose Window Group Dialog.

procedure TForm1.Install1GetWindowGroupName(Sender: TObject;

  var GroupName: OpenString; var Continue: Boolean);

begin

  if InputQuery('Add Program Items','Group Name',GroupName) then

    Continue := False;

end;


Example_TInstallOnPromptDiskEvent
OnPromptDiskEvent Example

This dialog shows you how to override my default Prompt Disk Dialog box.

procedure TForm1.Install1PromptDisk(Sender: TObject; DiskNumber: Integer;

  var Continue: Boolean);

begin

  MessageDlg('This is me overriding Bills default Prompt Disk

Dialog',mtInformation,[mbOk],0);

  MessageDlg('But seriously, put in disk #' +

IntToStr(DiskNumber),mtInformation,[mbOk],0);

  Continue := False;

end;


Exception_TAliasesEDuplicateAliasName
EDuplicateAliasName Exception

Applies  to

TAliases component

Declaration

EDuplicateAliasName = class(Exception);

Description

This exception is raised when you try to add an alias with a duplicate name.


TAliases_ExceptionPopup

Exceptions

EDuplicateAliasName


TAliasItem_ExceptionPopup

Exceptions

EDriverTypeNotSupported

EFileGroupNotFound


prop_TInstallOptions
Options Property

Applies To

TInstall

Declaration

property Options: set of (ioChooseWindowGroup,ioChooseFileGroups,ioShowDefaultCopyDlg);

Description

Allow the install component to display the default Choose File Groups Dialog by including  ioChooseFileGroups and disallow it by not including ioChooseFileDialog.

Allow the install component to display the default Choose Window Group Dialog Box by including ioChooseWindowGroup and disallow it by not including ioChooseWindowGroup.

Allow the install component to display the default File Copy Dialog by including ioShowDefaultCopyDlg and disallow it by not including ioShowDefaultCopyDlg.


prop_TInstallRSConnections
rtRSConnections property

Applies To

TInstall

Declaration

property rtRSConnections: TRSConnections;

Description

The rtRSConnections property provides information about the ReportSmith connections that will be added to ReportSmith.  Modify this property at run-time only.  Note: This is not a typo!  The RSConnections property that you see on the component editor can only be modified at Design-Time.  In order to change ReportSmith connections, you must go through this property.  In essence, they both point to the same data.  However, at run-time you must use this property.


event_TInstallOnAddRSConnection
OnAddRSConnection Event

Example

Applies To

TInstall

Declaration

property OnAddRSConnection: TAddRSConnectionEvent;

Description

This event is called for each ReportSmith connection.  The Index number can be used to obtain or alter information about the connection.


comp_TRSConnection
TRSConnection Component

The TRSConnection component holds information about an individual ReportSmith connection that will be added to ReportSmith by the Install component.  Excuse me while I get really lax on the documentation.  These are the properties of the component.

public

  property ConnectId: Integer; { Read-Only; Run-Time Only; This is the value for the Type= that

you see in the rptsmith.con file.  This will be generated according to how you set the published properties.}

  property Server: String;  { Read-Only; Run-Time Only; This is the value for the Server= that you see in the rptsmith.con file.  This will be generated according to how you set the published properties. }

published

  property Name: String; { Name of the connection as will be used by ReportSmith }

  property ConnectType: String; { These are the possible values: DBASE (IDAPI), dBASE for Windows, IBLOCAL (IDAPI), InterBase (ODBC), PARADOX (IDAPI), RS_Btrieve (ODBC), RS_Excel (ODBC), RS_FoxPro (ODBC), RS_MS_Access (ODBC), RS_Paradox (ODBC), RS_TEXT (ODBC).  If you try to assign something different a EUnknownConnectType exception will be raised }

  property DataFilePath: String; { Used for certain ConnectTypes.  If you are not sure look at ReportSmith }

  property UserId: String;  { Used for IBLOCAL (IDAPI) }

  property Database: String; { Used for IBLOCAL (IDAPI) }

  property Password: String; { Used for IBLOCAL (IDAPI) }


componentHelp_RSConnections
RSConnections Property Editor

You specify any number of ReportSmith connections to install on the target machine using this dialog.  If you have not yet defined any ReportSmith connections, you must hit the Add button.  Then you must specify the name of the connection.  The Name edit box allows you to do this (it is hooked to the Name property).  This name will be the name that is added to the target machine's ReportSmith connection file (\windows\rptsmith.con).

There are several things that you will need to fill out for each type of Connection Type.  If you are unfamiliar with these, refer to the ReportSmith documentation.


prop_TRSConnectionsCount
Count Property

Applies To

TRSConnections

Declaration

property Count: Integer;

Description

Use this property to obtain the number of ReportSmith connections that are on the list to be installed.


TRSConnections_PropertiesPopup

Properties

Connection

Count


prop_TRSConnectionsConnection
Connection Property

Applies To

TRSConnections

Declaration

property Connection[Index: Integer]: TRSConnection;

Description

You can access individual ReportSmith to be connections using this property.


TRSConnections_MethodsPopup

Methods

Add

Delete

IndexOf


method_TRSConnectionsAdd
Add Method

Example

Applies  to

TRSConnections component

Declaration

function Add(Name: String): Integer;

Description

The Add method allows you to add a new ReportSmith connection with the name specified by Name.


method_TRSConnectionsDelete
Delete Method

Example

Applies  to

TRSConnections component

Declaration

procedure Delete(Index: Integer);

Description

The Delete method deletes the specified ReportSmith connection in the RSConnection property.


method_TRSConnectionsIndexOf
IndexOf Method

Example

Applies  to

TRSConnections component

Declaration

function IndexOf(Name: String): Integer;

Description

The IndexOf method returns the index of the ReportSmith connection with name equal to Name.  IndexOf returns -1 if Name is not found.


Example_TRSConnectionsAdd
Add Example

This code snippit adds a new ReportSmith connection to the list of ReportSmith connections to install on the target machine.

var

  NewConnIndex: Integer;

begin

  try

    NewConnIndex := Install1.rtRSConnections.Add('FinanceReports');

    Install1.rtRSConnections[NewConnIndex].DataFilePath := 'c:\';

  except

    on E: EDuplicateConnectionName do

      MessageDlg('Oopps.. That was a duplicate',mtError,[mbOk],0);

  end;

end;


Example_TRSConnectionsDeleteMethod
Delete Example

This code snippit deletes a ReportSmith connection, from the list to install, with the name 'FinanceReports'.

with Install1.rtRSConnections do

  Delete(IndexOf('FinanceReports'));


Example_TRSConnectionsIndexOf
IndexOf Example

This code snippit deletes a ReportSmith connection, from the list to install, with the name 'FinanceReports'.

with Install1.rtRSConnections do

  Delete(IndexOf('FinanceReports'));


prop_TRSConnectionDataFilePath


Example_TInstallOnAddRSConnectionEvent
OnAddRSConnection Example

This code snippit shows a bare-bones way of allowing the users to select which ReportSmith connections to install.

procedure TForm1.Install1AddRSConnection(Sender: TObject;

  ConnectionIndex: Integer; var Continue: Boolean);

var

  ConnectionName: String;

begin

  ConnectionName := Install1.rtRSConnections[ConnectionIndex].Name;

  if MessageDlg('Do you want to add ' + ConnectionName + ' to ReportSmith',

     mtInformation,[mbYes,mbNo],0) = mrNo then

    Continue := False;

end;


type_TInstallAddRSConnectionEvent
AddRSConnectionEvent Type

Declaration

type TCannotFindFileEvent = procedure(Sender: TObject;ConnectionIndex: Integer;var

 Continue: Boolean) of Object;

Description

To tell the Install component NOT to add the ReportSmith connection set Continue to False.


Exception_TRSConnectionsEDuplicateConnectionName
EDuplicateConnectionName Exception

Applies  to

TRSConnections component

Declaration

EDuplicateConnectionName = class(Exception);

Description

This exception is raised when you try to add a ReportSmith connection to the list of ReportSmith connections to install, that has the same name as a connection in the list.


TRSConnections_ExceptionsPopup

Exceptions

EDuplicateConnectionName