>I have a PRG based class that gets call from several different places, but in each cause I need to change something on a form called 'ShwSch4' When I run the form by itself (not via a menu etc, but just typing the command DO FORM SHWSCH4) everything works ok. In the PRG I can do things like ShwSch4.Caption = 'Hi Mom' ( I can not for reasons of my program do things like _screen.Active.Caption = 'Hi Dad')
>
>When I try running this via the Menu I do not have a ShwSch4 object (I think because I am using the V.M.P. framework). Anyhow my question is this how can I get a reference to a screen as an object in a prg class? I want to do something like.
>
>oShwSch4 = ObjRef(shwSch4)
>
>Any Ideas?
Basically, there are two ways:
1. 'Brutal force' way when you search through _SCREEN.Forms collection matching e.g. Form.Name property until you will get needed form:
For Each oForm In _Screen.Forms
IF oForm.Name="myform_myform"
Return oForm
ENDIF
Endfor
2. You have form manager collection which handle all form pertained to particular part (or whole) of your application, i.e. when you start a form, you actually link to some element of this collection:
if isnull(this.achildrefs[nChildnumber])
this.achildrefs(nChildnumber)=createobject(cFormname)
endif
Edward Pikman
Independent Consultant