MyChildWindow is used to handle the child window of the current window. When running the window,
MyChildWindow is replaced by the window (and not by the name of the window).
Benefit: MyChildWindow can only be used in the event "Closing a child window". This keyword is used to handle in this code the characteristics of the child window that was closed. This allows you to retrieve:
- the name of the child window that was closed by the Name property.
- the value returned by the child window via the ReturnedValue property.
// Event "Closing a child window of WIN_List_Customers"
// -------------------------------------------------------------
// Refreshes the list of customers
LooperDisplay(LOOP_Customers, taReExecuteQuery)
// For any return (except for the deletion)
IF MyChildWindow.ReturnedValue <> -1 THEN
nIndex is int
// Finds the customer row
nIndex = LooperSearch(ATT_CustomerNum, Customer.CustomerNum)
IF nIndex > 0 THEN
// Positions on the customer row
LooperPosition(LOOP_Customers, nIndex)
END
END
Remarks
Finding out the value returned by a child window
MyChildWindow allows you to get the name of the child window closed as well as the value it has returned, when used in the "Closing a child window" event of the parent window (the window in which
OpenMobileWindow or
OpenChild were called).
For example:
- In the closing code of the child window, Close is used to return a parameter:
- The name of the child window as well as the returned value can be retrieved in the event "Closing a child window" of the calling window:
// Close a child window
NameChildWindow = MyChildWindow.Name
ValueChildWindow = MyChildWindow.ReturnedValue