if you have an object that is going to be defined/used later than the line you are referencing it in you need to use a forward reference (Register_Object)
generally a use statement will do
so you have firstview.vw
Code:
Object oMyFirstView is a dbView
Procedure TestInFirstView
..
End_Procedure
End_Object
and secondview.vw
Code:
Object oSecondView is a dbView
Procedure TestInSecondView
..
End_Procedure
End_Object
leaving discussions on proper encapsulation off the table for now lets say we want to call the first view from the second view
we will change the second view to
Code:
use firstview.vw
Object oSecondView is a dbView
Procedure TestInSecondView
Send TestInFirstView to oFirstView
End_Procedure
End_Object
this will compile and run without issues
now lets add a call from the first view to the second view as well
lets modify firstview.vw as follows
so you have firstview.vw
Code:
use secondview.vw
Object oMyFirstView is a dbView
Procedure TestInFirstView
..
End_Procedure
Procedure AnotherTest
Send TestInSecondView to oSecondView
End_Procedure
End_Object
thinking about what we did you would think this would end up in an issue for the compiler
compile starts compiling firstview.vw
finds line "use secondview.vw" and includes secondview.vw
finds line "use firstview.vw" and ?!@?!?
luckily the DF compiler, well actually the USE macro has a protection for this by not including a "USEd" file a second time and it will skip the use line at this time
so it keeps on compiling all the code in secondview.vw and then returns to firstview.vw to finish compiling
So in general a use should solve the issue.
But if you look back when it processes the secondview.vw file while it technically already included firstview.vw if only compiled one line and hasnt gotten to the object declaration of the view yet
Also there are some constructs that can get you in real trouble if you are placing a USE statement inside a view or dialog or report component (and i mean inside the view/report/dialog object)
If that component is deferred you can get into some real trouble