limelect 48 Posted October 21, 2020 (edited) Another one on an expert I have this part of an expert program list of component names var PackageServices: IOTAPackageServices; PackageCounter: Integer; ComponentCounter: Integer; InstalledComponentName: string; PackageServices := BorlandIDEServices as IOTAPackageServices; for PackageCounter := 0 to PackageServices.PackageCount - 1 do begin for ComponentCounter := 0 to PackageServices.GetComponentCount(PackageCounter) - 1 do begin InstalledComponentName := PackageServices.ComponentNames[PackageCounter, ComponentCounter]; <<<< here i get component name as a string On another program, that I want to merge the two. type TClassArray = array[1..{179} 169] of TPersistentClass; ClassArray: TClassArray = ( TBitmap, TGraphic, TOutlineNode, TGraphicsObject, Now to my question Is it possible to get from the above the component as TPersistentClass; which mean var x:TPersistentClass; x:=PackageServices.ComponentNames[PackageCounter, ComponentCounter]; <<<<< ??????? obviously one is string one is TPersistentClass; How to? Or am I wrong with my idea? Which mean getting all components as TPersistentClass, and not as strings Edited October 21, 2020 by limelect Share this post Link to post
Uwe Raabe 2057 Posted October 21, 2020 Although I am not aware of a way to get this directly, there actually is a function to get the TPersistentClass from the class name: GetClass Share this post Link to post
limelect 48 Posted October 21, 2020 @Uwe Raabe You are correct but information of components are in package > PackageServices PackageServices := BorlandIDEServices as IOTAPackageServices; Unless there is another way to get the component >TPersistentClass; in the package Share this post Link to post
limelect 48 Posted October 21, 2020 @Uwe Raabe It mite work thanks xx:TPersistentClass; xx:=GetClass(PackageServices.ComponentNames[PackageCounter, ComponentCounter]); Share this post Link to post
balabuev 102 Posted November 22, 2020 I guess the real reason, why Delphi represents components in packages as string names (as opposed to direct TClass references) is because a package can stay in non-loaded state. Look at IOTAPackageInfo.Loaded property. Share this post Link to post