Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Releasing/Closing Multiple forms
Message
De
03/04/2006 11:46:55
 
 
À
02/04/2006 22:42:31
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01101638
Message ID:
01109965
Vues:
32
>What Im trying to do is close others forms which is not created or part of a formset. For example, when I open the employee form/window, then I also open the department form and then the employment type form (I now have 3 open forms). When I click on the employee form and make it the active form (department and employment type form becomes inactive form) and click the close button it would also close the department and employment type forms. Is it possible or only in the formsets?

I do this with many of my designs as well (close multiple forms with the closing of a "parent" form) without the use of formsets (I don't use at all). I have a property in the "main" form for each of the "child" forms. This could be an array property or a collection. In the Init event of the "child" forms, pass a reference to the "parent" form (thisform) and then set a handle to the child form in the parent form:
PROCEDURE Init
LPARAMETERS poMainForm
IF ISNULL(poMainForm.ChildForm[1])
   lnCnt = 1
ELSE
   lnCnt = ALEN(poMainForm.ChildForm,1) + 1
ENDIF
DIMENSION poMainForm.ChildForm[lnCnt]
poMainForm.ChildForm[lnCnt] = thisform
ENDPROC
This gives you a handle to each of the "child" forms in the main (or "parent") form. When the parent form is closed, in the Destroy event:
PROCEDURE Destroy
FOR lnCnt=1 TO ALEN(thisform.ChildForm,1)
  IF VARTYPE(thisform.ChildForm[lnCnt]) = "O"
     thisform.ChildForm[lnCnt].Close()
  ENDIF
ENDFOR
ENDPROC
This will query to determine if any child forms are open and will close them with the main form.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform