Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CREATEOBJECT vs DO FORM.. NAME..
Message
From
15/04/2007 09:24:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01215967
Message ID:
01216026
Views:
23
>>IIRC, that is more or less the way the Visual Extend framework handles it - an array of forms, in the global applicatoin object. Of course, being a good framework, this is done so far in the background, and so transparently, that I usually don't have to check how it's done.
>>
>>>You can have an array property in your form manager class and have this array property hold a reference to each open form. When you done with the form, you should set this array element to NULL.
>>>
>>>That's an idea, I need to check on Monday at work how do I manage this problem in my form's manager class.
>
>
>Maybe something like this:
>
>PROCEDURE Init
>	This.AddToFormsCollection
>ENDPROC
>PROCEDURE Destroy
>	This.RemoveFromFormsCollection
>ENDPROC
>*
>** Add to Forms Collection (inorder to stay alive)
>*
>PROCEDURE AddToFormsCollection
>IF TYPE("_screen.FormsCollection") = 'O'
>	_screen.FormsCollection.Add(THIS)
>ENDIF
>ENDPROC
>*
>** Remove from Forms Collection (inorder to be allowed to die)
>*
>PROCEDURE RemoveFromFormsCollection
>LOCAL lIndex
>	FOR lIndex = 1 TO _Screen.FormsCollection.Count
>		IF _Screen.FormsCollection.Item(lIndex) = THIS
>			_Screen.FormsCollection.Remove(lIndex)
>			EXIT
>		ENDIF
>	ENDFOR
>ENDPROC
Yes, that would be one way. However, the way VFX works, IIRC, is a little different. Instead of do form, the user is expected to do something like goProgram.RunForm(). I am not sure about the method name right now, but goProgram is the application object. The method will add the form to the form collection in the application object.

Most of the time, I don't call this method explicitly: I just add the form to a table of available forms, and Visual Extend takes care of the rest (i.e., when the user selects "File | Open", he will see a list of available forms, depending on his access level).
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform