Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To release a form is NULL ok or need to Release()?
Message
 
 
To
11/03/2012 09:54:19
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01537966
Message ID:
01537974
Views:
32
>>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?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform