Subject Re: shortening references
From Andy Taylor <andy.taylor.1959@outlook.com>
Date Tue, 01 Sep 2020 19:38:26 -0400
Newsgroups dbase.getting-started

Gaetano,

Just insert code like the following to gain confidence in the object tree:

msgbox(""+this.name)
msgbox(""+this.parent.name)
msgbox(""+this.parent.parent.name)

What I don't understand is why you appear to have made the toolbar a child object of the rowset.
I would have made the Toolbar a child object of the form.

Andy

> the 3 parent references take me back to a FORM object but my limited
> understanding of object parenthood wrt SUBCLASSING doesn't allow me to
> determine with certainty is whether that is base.cfm or customerForm.cfm
>
> I think it should be customerForm because:
>
> the 1st parent takes me from the form's rowset to the query level
> the 2nd parent takes me to DMD level
> the 3rd parent takes me to the form level of customerForm.wfm
>
>
> Another thing that my limited understanding of object
> parenthood/variable visibility doesn't enable me to understand is why I
> cannot directly reference FORM.mytoolbar1 or customerForm.mytoolbar1 in
> the canSave event.
>
> Any guidance would be much appreciated.
>
> Cheers,
> Gaetano.
>
> On 02/09/2020 07:32, Lee Grant wrote:
> > Gaetano,
> >
> > It might just be a typo but.....
> >
> > On 9/1/2020 4:52 PM, Gaetano wrote:
> >>
> >> I am trying to shorten script references by creating a shortcut to the
> >> FORM object. This is in the tutorial's customer.wfm form that is
> >> subclassed from the base.cfm form, in case it matters.
> >>
> >> I found this suggestion from Michael Nuwer and Ken in an old post but
> >> I am unable to implement it.
> >>
> >> -------------------
> >> function from_onOpen
> >               ^
> > Could this be the problem?
> >
> >
> >> this.fMytablename1=form.testdatamaodule1.Mytablename1.rowset.fields
> >>
> >> function whatever
> >> form.fMytablename1["myfieldName"].value
> >> --------------------
> >>
> >>
> >> Essentially, in the canSave event of customer.wfm, I want to write
> >> something like:
> >>
> >> oF.mytoolbar1.resetToolbar()
> >>
> >> instead of
> >>
> >> this.parent.parent.parent.mytoolbar1.resetToolbar()
> >>
> >> Thanks for your help.
> >>
> >> Cheers,
> >> Gaetano.
> >>
> >
>