Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting object references to forms
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00382212
Message ID:
00382219
Views:
22
That was quick. What I am trying to do may not be worth doing this way, but I'd like to know if it's possible. Part of the idea here is not to have to redo my whole application. I figure there have to be uses for the hypothetical functions I'm looking for. The function I have given has already proved useful to me.

>The best way to do this would be to save your forms as classes and use CreateObject or NewObject to create an instance of your form.
>
>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform