Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check if another form is open
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01085589
Message ID:
01085613
Views:
12
>>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
>
What if the form is already open somewhere, does your code(which is nice) provide for switching to it rather then re-open it?
"Build a man a fire, and he's warm for a day.
Set a man on fire, and he's warm for the rest of his life."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform