* program main * oAppMain = Newobject('AppMain','\develop\fleet\classlibs\fleetforms.vcx') * AppMain is a Custom class oAppMain.DoForm('Maintenance') && Instantiate and show a form Read Events Clear all Close all QuitThe form's unload method calls oAppMain.RemoveFromStack(this)
* oAppMain.RemoveFromStack Lparameters loObject && The closing form Local lnPosition As Integer If Type('loObject') = 'O' And Not Isnull(loObject) lnPosition = Ascan(This.aForms,loObject.Name) If lnPosition # 0 Adel(This.aForms,lnPosition) Removeproperty(This,loObject.Name) If Alen(This.aForms) > 1 Dimension This.aForms(Alen(This.aForms) - 1) Else This.aForms(1) = Null Endif Endif Endif If Not Isnull(This.aForms[1]) For i = Alen(This.aForms) To 1 Step -1 loForm = 'This.o' + This.aForms(i) If Not &loForm..Visible &loForm..Visible = .T. Endif &loForm..Activate Exit Endfor Else * When no more windows are open Clear Events && Line gets executed but events are still being read Endif