Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
_screen.forms(i) release order
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00081911
Message ID:
00081921
Vues:
21
Mark,

You have to close them in reverse order of the Forms[] collection because it moves everything down.

You might try this instead:

for i = 1 to _screen.FormCount
_screen.Forms[1].Release()
endfor

Note the index is 1 not i, this should release them topmost form to bottommost.

If you've got parent forms "responsible" for child forms perhaps you need to rethink this and make it the Parent form's responsility to close and of it's child forms.

>In VFP5 (according to the debugger), the last opened form is forms(1) and the others are pushed down the ladder (previous forms(1) is now forms(2), etc.). In my shutdown procedure I have something like
>nFCount = _screen.FormCount
>for i = nFCount to 1 step -1
>    if type("_screen.forms(i)") = "O"
>       =aMembers(laDummy,_screen.forms(i),1)
>       * looks to see if the object has a release method
>       lnElem = (aScan(laDummy,"RELEASE") + 1) / 2
>       if lnElem >= 1 and Upper(laDummy(lnElem,2)) = "METHOD"
>          _screen.forms(i).release()
>       else
>          release _screen.forms(i)
>       endif
>       release all like laDummy*
>    endif
>endfor
>If 4 forms are open, this would release forms(4) first, forms(3) next, etc. This would seem to release the forms in the wrong order. To me the correct order is to release the last opened form first. So I reversed the order (for i = 1 to nFCount) and always release forms(1) instead of forms(i) because when forms(1) is release forms(2) becomes forms(1), and so on. This whole process crashed and burned because tables were closed prematurely because a parent form was closed before a child form. When the child form was released, you get error messages that the expected tables are no longer open.
>
>And if the last form opend is modal, it gets even more bizarre. So, in my shutdown I have to abort shutdown if the active window is modal.
>
>I am so confused. Anyone else observe this? Hints? Advice?
>
>TIA.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform