Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why closing all Forms on App Exit?
Message
From
08/04/2022 15:10:27
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01684122
Message ID:
01684123
Views:
56
>Hi,
>
>I wrote (or copied it from somewhere) the code below 10 years ago. And now I don't remember it's purpose. This code is called from the method, right after the READ EVENTS, when application is being closed.
>What is the purpose of closing all forms when a user wants to close the application?
>I tried to comment this code and only issue ON SHUTDOWN, after READ EVENTS, and I get no error when some forms are still open. The ON SHUTDOWN seem to close these forms anyways.
>
>
>	LOCAL lnForms, i, llDone
>	lnForms = _screen.formcount
>	FOR i = lnForms to 1 STEP -1
>
>		IF TYPE("_SCREEN.Forms(i)") <> "O" OR ISNULL( _SCREEN.Forms(i) )
>			LOOP 
>		ENDIF 
>
>		IF PEMSTATUS(_SCREEN.Forms(i), 'QueryUnload', 5) 
>      		    llDone = _SCREEN.Forms(i).QueryUnload() 
>      		   IF !llDone
>      			RETURN .F.
>      		  ENDIF 
>      	      ENDIF 
> 		_screen.Forms(i).Release
>	ENDFOR
>
>
>Thank you in advance for any input

Looks like an attempt to regularly close the forms and give them a chance to exit elegantly - no unsaved buffers, no unresolved validations, give the user a chance to click yes on a few buttons. Note that it returns .f. if at least one form's .queryUnload() returns .f. - so if the code in the form returns a „can't close now, look at this!“, then it shouldn't quit in the first place.

That's keeping things neat.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform