Activate TeePro extensions in my app.

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
H.Hasenack
Newbie
Newbie
Posts: 16
Joined: Thu Nov 10, 2011 12:00 am

Activate TeePro extensions in my app.

Post by H.Hasenack » Tue Feb 14, 2012 2:38 pm

My app uses runtime libraries, and also depends on the teepro extensions. Unfortunately the initialization section of the units are not called if they are not in the uses list of the main app, or if no code from the unit is directly linked into my own units.

Is there an 'easy' way to ensure all "pro" extensions are activated? I can do this by calling LoadPackage('Teepro916.bpl'), or by adding all pro units to tot uses list of the main app.

Any other useful tips?

Regards - Hans

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Activate TeePro extensions in my app.

Post by Yeray » Fri Feb 17, 2012 4:06 pm

Hi Hans,

Excuse us for the delay here.
We haven' forgotten you and we'll be back to you asap.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Activate TeePro extensions in my app.

Post by Narcís » Mon Feb 20, 2012 10:17 am

Hi Hans,

What about adding TeeEditPro unit to your uses section? Which exact problem do you have? Any specific unit missing?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

H.Hasenack
Newbie
Newbie
Posts: 16
Joined: Thu Nov 10, 2011 12:00 am

Re: Activate TeePro extensions in my app.

Post by H.Hasenack » Tue Feb 28, 2012 8:38 am

My app uses a plugin system for extenstions. These plugins are simply runtime packages that are in a subfolder and loaded during runtime.
In order to do this I have a kernel bpl and a very minimalistic exe file that depends only on some vcl runtime libs and the kernel bpl.
The kernel itself depends on the tchart libs, but does not require the tchart pro extensions.

Nevertheless, our end users want to use some of the pro features. But the pro features are not visible because the initialization sections of the corresponding packages are not executed when they are not explicitely mentioned in the exe uses list.
so: the problem is : I cannot see the tchartpro extensions in my tchart editor, only the tchart basic functionality

mycurrent solution now is a routine that scans all loaded bpl's and ensures all units are initialized like this:

Code: Select all

procedure InitializePackages(VAR aPackageList:THandleList);

  function lclInPackageList(const aHandle:Thandle):boolean;
  begin
    Result:=Assigned(aPackageList) and (aPackageList.IndexOf(aHandle)>=0)
  end;

  function lclIsPackage(aHandle:THandle):boolean;
  begin
    Result:=(aHandle<>0)
            and (GetProcAddress(aHandle, 'Initialize')<>nil)
            and (GetProcAddress(aHandle, 'Finalize')<>nil);
  end;

VAR Module:PLibModule;
begin
  Module := LibModuleList;
  while Module <> nil do
  begin
    if (Module.Instance<>0)
       and not lclInPackageList(Module.Instance)
       and lclIsPackage(Module.Instance) then
    begin
      if aPackageList=nil then
        aPackageList:=THandleList.Create;
      try
        InitializePackage(Module.Instance);
        aPackageList.Add(Module.Instance);
      except
        raise EModuleListError.CreateFmt('InitializePackages failed for [%s]',[ModuleFileName(Module.Instance)]);
      end;
    end;
    Module:=Module.Next;
  end;
end;
(off course there is also a counterpart for this)

Should adding TeeEditPro to my uses list (preferably only in my kernel.bpl) add/register all pro features? - Using XE2

(I was delayed a bit too - I had a one-week holiday )
Regards - Hans

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Activate TeePro extensions in my app.

Post by Yeray » Thu Mar 01, 2012 3:19 pm

Hi Hans,

As you'll see, the Pro classes are registered in the beginning of TeeEdiPro.pas. Isn't adding that unit to you uses clause solving the issue for you?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply