 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Thu Mar 30, 2006 11:04 pm Post subject: TList sorting again ... |
|
|
I am trying to get a TList sort working. I have declared a compare
function as
function CompareElementName(AP1, AP2: Pointer): integer;
begin
Result:=AnsiCompareStr(TMyObject(AP1).Name,TMyObject(AP2).Name);
end;
and assign it to the TList's sort method with:
procedure TBSCADBaseElementList.SortElements;
begin
Self.fElementsList.Sort(CompareElementName); //Line 3612
end;
The problem is that like this the compiler complains with the error:
[Error] unBSCADObjects.pas(3612): Incompatible types: 'Pointer' and
'_Pointer'
If I put in a "@", like this:
procedure TBSCADBaseElementList.SortElements;
begin
Self.fElementsList.Sort(@CompareElementName); //Line 3612
end;
The compiler is happy, but at runtime when Quicksort calls my compare
function I get:
exception class EAccessViolation with message 'Access violation at
address 00404634 in module 'MyApp.exe'. Write of address 005167FC'.
As far as I can tell it can't get to my object members.
Can anyone save me some anguish? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|