[DUG] Forms Activate Design decision
John Bird
johnkbird at paradise.net.nz
Wed Oct 4 17:52:47 NZDT 2006
A design question:
FormA (Main form) open all the time.
FormA opens FormB, and FormB filled with Data in On-activate event
FormB may open FormC or FormD for further details
When FormC or FormD is closed, sometimes FormB on-activate event is fired
again, sometimes not.
I haven't figured yet what decides whether FormB activate event gets fired
again - as far as I can tell its not whether FormC or FormD is modal or not.
I would prefer either it wasn't fired, or I could tell when it was going to
be so as to exit the event, as sometimes the data takes time to load again.
For instance opening Rave Report rvSystem printing options always does cause
a form (eg FormB) to get re-activated when it closes.
Is there a way I have missed to manage this?, or do I have to do some
housekeeping, eg
maintain my own state variable somewhere:
FormBLoadedData:Boolean
And in the FormB activate event have something like
if FormBLoadedData=true then exit;
LoadtheData;
FormBLoadedData:=true;
(this will prevent subsequent forms C and D reloading the data on FormB when
they close)
And on the close event for FormB have
FormBLoadedData:=false;
John
More information about the Delphi
mailing list