>>>>My main form which is a top-level form has A toolbar that is opened as in top-level form. What is a way to close main form from a click on a toolbar button?
>>>>
>>>>Thanks, Mark
>>>
>>>Forget variables, etc. You can only have 1 top-level form in your app so use the following code to get an object reference to your TLF:
>>>LOCAL loForm, loRetObj
>>>loRetObj = NULL
>>>FOR EACH loForm IN _SCREEN.FORMS
>>> IF loForm.SHOWWINDOW = 2
>>> loRetObj = loForm
>>> EXIT
>>> ENDIF
>>>ENDFOR
>>>RETURN loRetObj
>>>
>>
>>Ok, I tried in a click on a button on a toolbar:
>>FOR EACH loForm IN _SCREEN.FORMS
>> IF loForm.SHOWWINDOW = 2
>> loForm.Release()
>> ENDIF
>>ENDFOR
>>
>>So the toolbar desapears but the main form is stil there completelly unaccessible. My question is how to release top form from a toolbar.
>
>I make sure all other child forms are closed first. I then issue a CLEAR EVENTS, release any global application objects, then release the TLF.
Here is a code in a Click method:
This.Parent.Release() && releases toolbar
CLEAR EVENTS
FOR EACH loForm IN _SCREEN.FORMS
IF loForm.SHOWWINDOW = 2
loForm.Release()
ENDIF
ENDFOR
Same thing. Top form is still on the screen.