I am making a form manager which will DO FORM myform.scx, oForm.Show, oForm.Release and that sort of thing. In order to make it flexible and reduce dependencies, I don't want to require the forms to "register themselves" with the form manager. I therefore need a means of getting object references to forms when I start with a form name, or vice versa. If my method receives "myform.scx" or just "myform" as a parameter, I can DO FORM myparameter. But I don't know how to take "myform" and get an object reference oForm for it (assuming the form already exists). If I have the form.Name property value, I can get oForm like so:
FOR nLoop = 1 TO _SCREEN.Formcount
IF _SCREEN.Forms(nLoop).Name = cFormName
oFormRef = _SCREEN.Forms(nLoop)
RETURN .T.
ENDIF
ENDFOR
...though it would be nice to have a function that didn't require looping like this. However, if I have form.Name, I don't know a way to get the name of the .scx so I can then DO FORM. So:
IF I HAVE I NEED
myform.scx oForm
"Form.name property value" myform.scx
Thank you. I hope this makes sense.