Hi Tom,
I presume you mean the Retrieve function.
Retrieve function as part of its work triggers a lot of fevents as the retrieve + display process progresses: RetrieveStart, SQLPreview, DBError, RetrieveRow, RetrieveEnd, RowFocusChanged, ItemFocusChanged
Every "window" consists of two components:
- The class = the code incl. properties, functions, and event scripts
- A global variable named IDENTICAL to the class
Depending on how you open your window you will see behavior you describe. Code samples:
// ---- ---- ---- ---- ---- EXAMPLE 1 ---- ---- ---- ---- ----
// Use global "class" variable
Open(w_window1)
// NOW: w_window1 references new window of class w_window1
// NEXT: VALID
w_window1.dw_1.Retrieve( )
// ---- ---- ---- ---- ---- EXAMPLE 2 ---- ---- ---- ---- ----
// Use other variable
w_window1 lw_myWindow
Open(lw_myWindow)
// NOW: lw_myWindow references new window of class w_window1
// NEXT: VALID
lw_myWindow.dw_1.Retrieve( )
// NEXT: FAILS (global variable unassigned)
w_window1.dw_1.Retrieve( )
In any case you will have to open the window to ensure your code references an valid window reference. You can use IsValid(...) and IsNull(...) to check for valid reference.
// Safest way to check valid reference
if IsValid(w_window1) and not IsNull(w_window1) then
w_window1.dw_1.Retrieve( )
end if
// Alternative: Assert open window prior to retrieve
if IsNull(w_window1) or not IsValid(w_window1) then
Open(w_window1)
end if
w_window1.dw_1.Retrieve( )
HTH /Michael