Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To release a form is NULL ok or need to Release()?
Message
From
11/03/2012 10:32:20
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01537966
Message ID:
01537975
Views:
34
>>>Hi,
>>>
>>>I have a procedure/function in my application that closes (I suppose) releases all open forms. The procedure sets the variable that references the open form to NULL. Now I got to think about if this is the right approach. Is it better to call the Release() method? Here is the segment of my code:
>>>
>>>
>>>Function CloseForm
>>>lparameter tcFormName
>>>
>>>*-- Find this form in the array of all currently open forms
>>>FOR nRow = 1 to alen( aAppForms, 1 )  
>>>
>>>    *--- Found the element/row of the array matching search criteria!
>>>    IF aAppForms[nRow,3] = tcFormName
>>>        *-- Column 5 of the array stores the reference to the open form
>>>        aAppForms[nRow,5] = NULL
>>>       EXIT 
>>>    ENDIF 
>>>
>>>NEXT 
>>>
>>>
>>>Is it better to change the above aAppForms[nRow,5] = NULL with aAppForms[nRow,5].release()?
>>
>>
>>Setting the refernce to null will not close the form ( if started with DO FORM ...)
>>
>>Best is to use
>>
>>= m. aAppForms[nRow,5].release()
>>
>>
>>After that, provided the queryUnload() returns true, aAppForms[nRow,5] and all other places that hold a reference to that form, will be null
>
>One thing in the above is a little confusing. When I call .Release() of a form object, the QueryUnload() is not fired. This is how I thought it always worked; that is, the QueryUnload() only fires when you close the form by clicking on the X in the upper right side of the window. Did you mean to say Unload instead of QueryUnload?


No, no, no. Yes, you're right - calling Release() does not trigger QueryUnload()
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform