>>>Hi,
>>>
>>>I have a form and in one of the methods of this form I want to release this form (based on some condition). So I have code
>>>
>>>thisform.release()
>>>
>>>
>>>But the form is not released. The program goes to the next line after the thisform.release(). How do I release a form in a middle of any method of the form?
>>
>>
>>Add a return after thisform.release() ?
>>
>>>
>>>thisform.release()
>>return
>>>
>
>Hi Gregory,
>
>I do have a return right after the thisform.release() but still the program goes to the method that called this message with .release(). There got to be something else missing. Thank you for the suggestion.
Hi Dmitry,
Yes, this is - say - by design
I see two possibilities - There may be better ways - I do not see any at this moment
(1) You can try "return to master" - I have not tested this
= m.thisform.Release()
return to master
(2) The calling hierarchy has to be made aware that the form is being released
You can add code to your form's baseclass.Release()
- add a propertery to the base class: Releasing
this.Releasing = .t.
return DoDefault()
But each calling method would have to test
say
- func1
- func2
func3
= m.this.func1()
if( m.this.Releasing )
return
= m.this.func2()
if( m.this.Releasing )
return
= m.this.func3)
if( m.this.Releasing )
return
if( ... )
=m.this.Release()
return
Gregory