Subject Re: this.parent
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Wed, 18 Nov 2020 21:08:27 -0800
Newsgroups dbase.getting-started

On 11/18/2020 7:28 PM, Moses Hanna wrote:
> Hi
> I have an entryfield object ... form.visitcr.time1ef
> If i want to refer to it from rowset.cannavigate function
> I am using        if not empty(form.visitcr.time1ef.value)
> gives me error msg variable undefined
> i this I have to use something like this.parent... etc but I dont get it
> exactly
> some help ?
> Moses

The rowset (and query) objects do not know what a form is. There are
multiple ways around this, including adding a custom property to the
query object such as:

form.queryname.parent = form

Another is in the rowset's canNavigate code:

this.parent.parent // parent 1 = query, parent2 = form

In a case like that I tend, in my own code to put the form reference
into a variable:

oForm = this.parent.parent

Then I can refer to any objects in that code:

oForm.time1ef.value

(or whatever ... modify as needed)

If the query is in a datamodule it gets more complex, but hopefully this
will give you the right ideas.

Ken


--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm