>>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?
If lnNoParms = 3 && If want an object name with it too &tcObjectName.Text1.SetFocus Name &tcObjectName Else &tcPhysName.Text1.SetFocus EndifNow, in debug locals window, there's a whole bunch of .Controls drill-down, if they can be used in code, if you don't know at run-time the name of the, say, first control on the object form.