[fpc-pascal] GetPropValue and Unknown property

Antonio Sanguigni a.sanguigni at gmail.com
Tue Jun 23 12:41:56 CEST 2009

Hi all,

I'm trying to derive a new class TSortFtpSend from synapse TFtpSend
class, which implements a quicksort algo based on published property
passed to this method.
I'm having some troubles with this code because GetPropValue seems
does not find the published property I need:

function TSortFtpSend.DoCompareByProps(AItem1: Pointer; AItem2: Pointer;
  const ASortProps: array of string; AAscendingOrder: Boolean): integer;
  i : integer;
  lsPropName : string;
  lValue1 : variant;
  lValue2 : variant;
  result := 0;
//  try
    for i := Low(ASortProps) to High(ASortProps) do
      lsPropName := ASortProps[i];
      lValue1 := GetPropValue(TFTPListRec(AItem1),lsPropName); // <==
Here I got the Unknown property FileSize exception
      lValue2 := GetPropValue(TFTPListRec(AItem2),lsPropName);


It seems GetPropValue cannot find published property FileSize but the
writeln statement works well printing the exact value, and of course
the properties are published. Someone has an idea why that is not
working here ?


Antonio Sanguigni alias slapshot
GioveLUG (Linux User Group) - http://www.giovelug.org
Edupup (Educational distro) - http://www.pieroni.biz/edupup

More information about the fpc-pascal mailing list