You are reading help file online using chmlib.com
|
Rave Reports Developer Guide RvDLSampleCfg . |
Top Previous Next |
The primary purpose of the configuration form is to edit the DataSource, UserName, Password and OptionList configuration variables. The OptionList variable should be used to store any configuration values other than the DataSource, UserName or Password by using the OptionList.Values property. The configuration form is displayed when a RaveDatabase component is first created or when the AuthDesign/AuthRun properties are edited. The configuration form should descend from the TDLConfigForm class and needs to override the SetData and GetData methods. The SetData method is called before the form is shown to the user and is the place where the form controls should be initialized to the values stored in the configuration variables. The GetData method is called after the form is closed (assuming the OK button was pressed) and is the place where the data from the form controls should be copied to the configuration variables.
unit RvDLSampleCfg;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ActnList, RvDLBase;
type TDLSampleConfigureForm = class(TDLConfigForm) // Make sure to change form type to TDLConfigForm! { ... Form Components and Events ... } private public procedure SetData(ADataSource, AUserName, APassword: string; AOptionList: TStringList); override; procedure GetData(var ADataSource, AUserName, APassword: string; AOptionList: TStringList); override; end;
implementation
{$R *.dfm}
uses RvDLCommon, RvDLSample;
procedure TDLSampleConfigureForm.SetData(ADataSource, AUserName, APassword: string; AOptionList: TStringList); begin { Initialize form controls from ADataSource, AUserName, APassword and AOptionList here. Sample code below. } editDataSource.Text := ADataSource; editUserName.Text := AUserName; editPassword.Text := APassword; editOption1.Text := AOptionList.Values['Option1']; editOption2.Text := AOptionList.Values['Option2']; end;
procedure TDLSampleConfigureForm.GetData(var ADataSource, AUserName, APassword: string; AOptionList: TStringList); begin { Assign new values to ADataSource, AUserName, APassword and AOptionList here. Sample code below. } ADataSource := editDataSource.Text; AUserName := editUserName.Text; APassword := editPassword.Text; AOptionList.Values['Option1'] := editOption1.Text; AOptionList.Values['Option2'] := editOption2.Text; end;
initialization RvDLBase.ConnectionConfigureForm := TDLSampleConfigureForm; // Assign the driver config form type end.
The configuration form can contain any controls that are needed to allow the user to define a connection to a database however the overall layout of the form should be similar to the DataLink drivers that ship with Rave including the use of a TPageControl component to contain the separate configuration sections. A recommended addition to the configuration form is a button to test the configuration parameters. The code in the button should call the TestConnection method. This method takes a single TStrings parameter which will return a list of tables in the connection if the test is successful. Normally the list of table names is displayed in a TListBox component.
|
You are reading help file online using chmlib.com
|