Article View: a.bsu.programming
Article #87187Re: Type Procedure Pascal(TPW)
From: nwes
Date: Sun, 04 Feb 1996 00:00
Date: Sun, 04 Feb 1996 00:00
37 lines
2232 bytes
2232 bytes
>Hallo All,
>I tried to create a Method for a TCollection which works similar to
>ForEach or FirstThat. Unfortunately I allways receive a Runtime-Error
>when calling the Method. I know exactly where the Error occurs but i
>dont know why. Any idea how it could work?
>Type
> PColFunc = ^TColFunc;
> TColFunc = function(item: Pointer):boolean;
>Type
> PObjSave = ^TObjSave;
> TObjSave = Object(TCollection)
> procedure DelEach(Test: pColFunc);
> end;
>procedure TObjSave.DelEach(Test: pColFunc);
>Var AnyObj: Pointer; idx: word; TestFunc: tColFunc;
>begin
> if Count = 0 then exit;
> idx:= 0;
> TestFunc:= Test^;
> Repeat
> AnyObj:= At(idx);
> if TestFunc(AnyObj) then => Runtime-Error!!!
> Delete(AnyObj)
> else inc(idx);
> until idx = count;
>end;
>{*********** Testmethode im Window **********************************}
>procedure TWind.DelEachTest(var Msg: TMessage);
> function isOdd(AnyObj: pGraphObj): boolean;far;
> begin
> isOdd:= Odd(AnyObj^.ObjID);
> end;
>begin
> pObjSave2^.DelEach(@isOdd);
>end;
>Thanks Freddy
Technical Details
Message-ID:
<4f1nmc$kdk@serv.hinet.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4eu2a2$910@dub-news-svc-5.compuserve.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110467,24ca31f46b32e9ca X-Google-Attributes: gid110467,public X-Google-Thread: 107d8b,24ca31f46b32e9ca X-Google-Attributes: gid107d8b,public X-Google-Thread: 102601,24ca31f46b32e9ca X-Google-Attributes: gid102601,public X-Google-Thread: fd1d1,24ca31f46b32e9ca X-Google-Attributes: gidfd1d1,public X-Google-Thread: f88b3,24ca31f46b32e9ca X-Google-Attributes: gidf88b3,public X-Google-Thread: 111659,24ca31f46b32e9ca X-Google-Attributes: gid111659,public X-Google-Thread: 10263e,24ca31f46b32e9ca X-Google-Attributes: gid10263e,public X-Google-Thread: fe201,24ca31f46b32e9ca X-Google-Attributes: gidfe201,public From: nwes@HiNet_Gateway.pc2.hinet.net Subject: Re: Type Procedure Pascal(TPW) Date: 1996/02/04 Message-ID: <4f1nmc$kdk@serv.hinet.net> X-Deja-AN: 137979431 references: <4eu2a2$910@dub-news-svc-5.compuserve.com> organization: HiNet newsgroups: a.bsu.programming,comp.lang.pascal.borland,comp.os.ms-windows.programmer.tools.owl,ctdl.lang.pascal,de.comp.lang.pascal,fido.ger.pascal,maus.lang.tpascal,slac.lang.pascal,z-netz.sprachen.pascal