| Subject |
Re: Subform canClose |
| From |
Andy Taylor <andy.taylor.1959@outlook.com> |
| Date |
Mon, 08 Mar 2021 16:53:20 -0500 |
| Newsgroups |
dbase.getting-started |
Peter,
I see Mervyn has given you a neat alternative to disable closing the subForm by removing the "X".
The reason that your parent form refuses to close is that the parent form by design calls a subForm canClose as part of the main form built-in canClose process; and your subForm always returns false.
The trick to get round this is to reset the subForm response as part of the parent form canClose method as follows:
function form_canClose
form.subF.canClose = {||true}
// do my things
*form.close() // not required as the form is closing anyway... why call it twice?
return
Hope that helps,
Andy
> Hi Andy
>
> I mean it just the other way around. I just want to prevent someone from
> closing the subform.
>
> It's ok if the mainform is closed. then the subform should be closed too.
>
>
> Am 08.03.2021 um 11:34 schrieb Andy Taylor:
> > Hi Peter,
> >
> > In my view this is WAD.
> > A sub-form is exactly that; it should have no existence outside of it's parent.
> > If the parent closes the sub-form has to close before the parent does.. absolutely.
> >
> > It might be helpful to explain why you want the sub-form to stick around?
> >
> > Andy
> >
> >> Hi
> >>
> >> I would like to prevent the Subform from closing. But the mainform
> >> should close. It seems that subform.canClose is effectiv for both forms.
> >>
> >> Bug or not?
> >>
> >> Peter
> >>
> >>
> >>
> >> ** END HEADER -- Diese Zeile nicht entfernen
> >> //
> >> // Erstellt am 08.03.2021
> >> //
> >> parameter bModal
> >> local f
> >> f = new neuForm()
> >> if (bModal)
> >> f.mdi = false // Nicht-MDI festlegen
> >> f.ReadModal()
> >> else
> >> f.Open()
> >> endif
> >>
> >> class neuForm of FORM
> >> with (this)
> >> onOpen = class::form_onOpen
> >> canClose = class::form_canClose
> >> metric = 6
> >> height = 250
> >> left = 100
> >> top = 80
> >> width = 600
> >> text = "Testform"
> >> endwith
> >>
> >> this.SubF = new subform(this)
> >> with (this.SubF)
> >> canClose = {||false}
> >> colorNormal = "Moccasin"
> >> metric = 6
> >> borderStyle = 4
> >> left = 600
> >> top = 60
> >> width = 400
> >> height = 230
> >> text = "Daten bearbeiten"
> >> visible = true
> >> sizeable = false
> >> moveable = false
> >> systemTheme = false
> >> maximize = false
> >> minimize = false
> >> escExit = false
> >> smallTitle = true
> >> endwith
> >>
> >> function form_onOpen
> >> form.SubF.open()
> >> return
> >>
> >> function form_canClose
> >> // do my things
> >> form.close()
> >> return
> >>
> >> endclass
> >
>
|
|