Project

General

Profile

TH3-Object Neighborhood » History » Version 1

Wil van Antwerpen, 11/28/2019 05:08 PM

1 1 Wil van Antwerpen
# TH3-Object Neighborhood
2 1 Wil van Antwerpen
3 1 Wil van Antwerpen
In recent versions of DataFlex you do not have to use the full object path notation when addressing objects.
4 1 Wil van Antwerpen
5 1 Wil van Antwerpen
Eg.
6 1 Wil van Antwerpen
7 1 Wil van Antwerpen
~~~
8 1 Wil van Antwerpen
Get Value Of (oMyForm(oGroup(oTabPage1(oTabDialog(Self))))) to sValue
9 1 Wil van Antwerpen
~~~
10 1 Wil van Antwerpen
can be written as
11 1 Wil van Antwerpen
12 1 Wil van Antwerpen
~~~
13 1 Wil van Antwerpen
Get Value Of oMyForm to sValue
14 1 Wil van Antwerpen
~~~
15 1 Wil van Antwerpen
16 1 Wil van Antwerpen
The latter form is much easier to read and does not trigger runtime errors when you move your oMyForm to a location out of the oGroup object.
17 1 Wil van Antwerpen
18 1 Wil van Antwerpen
In DataFlex this is referred to as "Object Neighborhood".
19 1 Wil van Antwerpen
20 1 Wil van Antwerpen
The object neighborhood refactor -which has some overlap with the drop self option- does work very well with any nesting level. But the object has to be defined in the current document. Which is basically a requirement for object neighborhood too.
21 1 Wil van Antwerpen
22 1 Wil van Antwerpen
It does actively check if it can find your object and even verifies if there's another object with the same name as to prevent breakage.
23 1 Wil van Antwerpen
If two objects of the same name exist then it will try to make the object notation shorter, but I think that in most cases it will actually just skip offering to refactor for now as the alternative it will offer is likely to be just as long or longer as the notation you have now.