Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Can I get the order that each form is created or activated?
Is there a reliable way to determine the actual order in which forms are opened or used? I know that _SCREEN.FORMS() lists all active forms. I use mostly modeless forms to allow the user to open multiple forms, cascade forms, copy and paste between forms, etc.
There are a couple or reasons that I ask this question.
1. The user can open and minimize so many forms that the desktop can get very cluttered and confusing. I have code that prevents multiple instances of the same form, so that is not a problem. I would like to be able to limit the number of opened forms to reduce clutter and confusion. Perhaps automatically close minimized forms in a FIFO order once the limit is reached.
2. When the application needs to perform maintenance, the workstation initiating the maintenance task broadcasts a message to let all other users know that they should exit the app. After a specified time has passed, each workstation automatically shuts down the app. I need to be sure that this auto-shutdown procedure releases the active forms in the correct order to properly clean up and quit. The order of releasing modeless forms does not seem to matter, but if a modeless form calls a modal form or a modal form calls another modal form, the modal forms must be released in the reverse order in which they were created.
From my tests, it appears that _SCREEN.FORMS() keeps track of forms such that _SCREEN.ActiveForm is always _SCREEN.FORMS(1) and all others are listed in descending order of their last activation.
Is this a correct assumption? (That word always gets me into trouble. <s>)
If I can depend on this to ALWAYS be the case, I already know how to do what I need to do. I just don't want automatically release a form that the user is actively using. Or worse yet release modal forms in the wrong order. If memory serves me, I have done that in the past and it locks up the application.
Can anyone confirm how _SCREEN.FORMS() collection orders forms.
TIA
Elmer
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement