>
>>>PUBLIC poForm
>>>* DO FORM... Commented
>>>poForm = CREATEOBJECT(yourForm, < maybe some parameters, if you have them > )
>>>poForm.Show(1) %% Modal or
>>>poForm.Show(2) %% Modeless
>>>
>>>RELEASE poForm
>>
>>Daniel, if you link form object to some variable and then release this variable then you effectively kill the form, i.e. above example will not work for modeless form. Actually, any newly created form obvject should be linked to some property of higher-level object and this hogher-level object will provide on-request reference to any form in application.
>
>Yes, I realize that, Edward. Actually, what I ment in the above example was that "RELEASE poForm" should be in "Quit" button of the form, otherwise the modeless form, naturally, dissapears right away.
>
>Still with me on this one?
Not exactly. Firstly, it shouldn't be public variable. Also, as I said, it's handled by some method of higher-level object:
***oEditModule.CloseChild
LParameter cFormname
nForm=This.GetFormNumber(cFormname)
This.Moduleforms(nForm).Release
This.Moduleforms(nForm)=.NULL.
When you start a form:
***oEditModule.StartForm
LParameter cFormname
nForm=This.GetFormNumber(cFormname)
if type("This.Moduleforms(nForm)")="O" and not isnull(This.Moduleforms(nForm))
This.Moduleforms(nForm).Show
else
This.Moduleforms(nForm)=createobject("MyEditFormClass")
endif
Modeless form will never disappear if it's linked to upper-level object. That's the difference from linking to variable.
Edward Pikman
Independent Consultant