How to use a Delphi component in CPPB?


2005-08-29 03:07:23 PM
cppbuilder47
I have created a delphi component set (3 in all) that I use in Delphi
to manage internationalization issues like switching the application
language. This works fine in various versions of Delphi, but now we
also need to use this in a CPPB application that is being built by one
of our developers (the only one with any C++ experience).
We tried to simply add the component to the CPPB IDE and to the project
and the results were not 100%....
The components installed just fine, but they cannot be used in CPPB
since we don't know how to address a few special programming issues.
Any help appreciated.
Our problem is like this:
There is a main application level component that is supposed to be put
on a data form and then there is another component that should be put
on each form where we need language support.
In order for the system to work we also need to code a few Form level
methods.
On the Data form:
------------------
We create an overridden procedure Loaded with the following contents:
procedure TdtmCommon.Loaded;
var
sDir : string;
begin
inherited Loaded;
mgrAppLang.AddFormClass(TfrmMain);
mgrAppLang.AddFormClass(TfrmLicenseReg);
end;
The idea here is to create a connection between the mgrAppLang
component and the various forms used in the application so that methods
executed on application level can propagate to the various forms.
Problem: We don't know how to specify the form classes in CPPB.
On the application forms:
----------------------------
In the overridden Loaded procedure here we want to add exclusions from
language handling like this:
with mgrFormLang.ExcludeList do
begin
Add(txtServer);
Add(txtDatabase);
end;
Here we have the following problem:
The ExcludeList is defined as
FExcludeList: TCompRefList;
where
TCompRefList = class
private
FList: TList;
function GetCount: Integer;
public
constructor Create;
destructor Destroy; override;
procedure Add(Component: TComponent);
function IndexOf(Component: TComponent): Integer;
function InList(Component: TComponent): Boolean;
property Count: Integer read GetCount;
end;
As you can see the items are TComponent and now we again have a problem
of how to reference a class into a list using CPPB.
Could anyone out there shed some light on this or should I ask in
another group? (Which?)
TIA,
Bo B