Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to check if another form is open
Message
De
11/01/2006 09:37:51
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01085589
Message ID:
01085608
Vues:
17
>I want to be able to ascertain if another form is open, then transfer control to that form. It sounds easy but can't

Tim

Perhaps the following will help. It sees if a form is NOT open and opens it if not. A man of your calibre can easily tweak it to the reverse. :-)

Terry
Function sysFormOpen
*___________________
find the syntax for this.
* Supplied with a form's name property, go thru list of
* open forms to see if that form is open.
* ____________________
LPARAMETER  tcFormName
LOCAL	   lnFormCount, llOpen, lnFormNo, lnOpenFormNo

llOpen			= .F.
lnFormCount 		= _SCREEN.FormCount
lnOpenFormNo		= 0
If lnFormCount > 0
    lnFormNo 		= 1
    Do	WHILE	lnFormNo <= lnFormCount ;
	AND	not llOpen
      If ALLTRIM( LOWER( _SCREEN.Forms( lnFormNo).Name)) = ALLTRIM( LOWER( tcFormName))
	llOpen		= .T.
	lnOpenFormNo	= lnFormNo
      Else
	lnFormNo		= lnFormNo + 1
      Endif
    EndDo
Endif

Return lnOpenFormNo	&& index of specified form

Procedure sysOpenForm
*____________________
* If a named form is not already open, open it by physical name
* Else just ignore
* ________________
LPARAMETERS  tcFormName, tcPhysName, tcObjectName
LOCAL	    lnNoParms

lnNoParms	= PARAMETERS()
If not sysFormOpen( tcFormName) > 0	&& If supplied form not already open
    If lnNoParms = 3		&& If want an object name with it too
	do FORM &tcPhysName Name &tcObjectName
    Else
	do FORM &tcPhysName
    Endif
Endif
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform