🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #72

Sv: TechTips: Avoiding unavoidable recursion in event-handlers ...

#72
From: Finn Tolderlund
Date: Mon, 06 Dec 1999 00:00
27 lines
1878 bytes
It is much simpler just to set the eventhandler to nil upon entry and
restore it upon exit.
That way there is no need to define any variables.

Finn Tolderlund

Sundial Services <info@sundialservices.com> skrev i en
nyhedsmeddelelse:384BDF64.10D8@sundialservices.com...
> (1) Define a boolean variable, in the "private" section of your class
> declaration.  Let's call it "recursionLock."  You might have several of
> these, depending upon how many potentially-recursive paths you have.
> Notice that this must not be a *local* variable, nor should it be
> *global.*
>
> (2) Now for your method-code.  Modify it like this:
>
> method ...
> ...
> begin
>   if RecursionLock then exit;
>           try
>     RecursionLock := true;
>     << original method code goes here >>
>   finally
>     RecursionLock := false;
>   end;
> end;
Technical Details
Message-ID: <VGR24.17$bf.283@news0.mobilixnet.dk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <384BDF64.10D8@sundialservices.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff75c,621456c0b23430b
X-Google-Attributes: gidff75c,public
X-Google-Thread: ffff5,621456c0b23430b
X-Google-Attributes: gidffff5,public
X-Google-Thread: 10baee,621456c0b23430b
X-Google-Attributes: gid10baee,public
From: "Finn Tolderlund" <XnospamYfinn.tolderlundX@Ymobilixnet.dkXnospamY>
Subject: Sv: TechTips:  Avoiding unavoidable recursion in event-handlers ...
Date: 1999/12/06
Message-ID: <VGR24.17$bf.283@news0.mobilixnet.dk>
X-Deja-AN: 557314604
References: <384BDF64.10D8@sundialservices.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Complaints-To: abuse@mobilixnet.dk
X-Trace: news0.mobilixnet.dk 944498485 212.97.198.26 (Mon, 06 Dec 1999 17:41:25 MET)
Organization: Mobilix Internet -- http://www.mobilixnet.dk/
X-MSMail-Priority: Normal
NNTP-Posting-Date: Mon, 06 Dec 1999 17:41:25 MET
Newsgroups: comp.lang.pascal.delphi.misc,comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop