Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Releasing forms programmatically
Message
From
20/12/2022 07:02:01
 
 
To
19/12/2022 20:27:14
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01685522
Message ID:
01685531
Views:
53
>>In a complex application, we've set up a timeout (based on the code I published here: http://www.tomorrowssolutionsllc.com/Articles/Taking%20Advantage%20of%20Idle%20Cycles.PDF) that shuts down the application if the user does nothing (no keystrokes, no mouse movements) within a specified time. It works well, except in one situation.
>>
>>If the user has stopped with a modal form open on top of another modal form on top of a modeless form, the code to close all the forms fails. Here's the code:
>>
>>What happens is that the modal form on top closes, but the one below it doesn't. When its Release method is called, nothing happens--no events fire. That same form remains first in the Forms collection, so we spend the remaining passes through the loop just trying to release that form.
>>
>>If we have a single modal form open over a non-modal form, all is well and things shut down as expected. I don't think this application has any cases where we can have a modal form over a modal form without a non-modal form underneath, so I can't test that.
>>
>
>
>Hi Tamar.
>
>I'd suggest the following -
>1) go through the forms backwards.
>2) If a form fails try another pass.
>So, basically (without error checking) -
>
>llProcess = .T.
>Do While llProcess And _Screen.FormCount > 0
>	llProcess = .F.
>	For i = _Screen.FormCount To 1 Step -1
>		Try
>			_Screen.Forms[i].Release()
>			llProcess = .T.
>		Endtry
>	Endfor
>Enddo
>
>

Thanks. We're actually going forward through the list on purpose, but I may have to go back to my notes to find out why it was important to do it in that order (or just try it the other way to see what fails and whether I can find a workaround for that). I'm almost certain I originally wrote it to go backward.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform