Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why closing all Forms on App Exit?
Message
 
 
À
08/04/2022 15:10:27
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
01684122
Message ID:
01684125
Vues:
43
>>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.

From your message it appears that the above code is not a must I just want to enclose it in TRY/CATCH And if the TRY/CATCH fails, I wont worry about it.
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform