The "classic" way to close a simple window with WINDEV is to use Close(WindowName, Returned value1) etc ...

But with internal windows, embedded inside Dynamic TABs, this does not work anymore.

You can find more information in PCSoft's help, about the right way to do it, but it will take you some time to understand it and clear up the "little but important" details.

The a360_CloseWindow() procedure, takes care of all these "closing issues" in a simple and elegant way. 

Just use the following code, inside your internal windows:

// Remove the Internal Window from the DynamicTAB
a360_CloseWindow(p_OpenWindow.sDynamicInternalWindowKey,...

                 p_OpenWindow.sDynamicInternalWindowID, ...

                 p_OpenWindow.sReturnTOWindow,...

                               sReturnThis)

In the alpha360 projects, this code is always in a procedure, local to the internal window, and named UI_Close.

Here is a short explanation of the variables used in the above procedure:

  • .sDynamicInternalWindowKey and .sDynamicInternalWindowID come from the structure we passed when "opening the window" and are automatically constructed and handled by the UI.
  • .sReturnTOWindow - if used, tells the UI to which "internal window" it must "try" to give focus after "closing" the "window". 

We say "try", because this "internal window" may have been closed by the user.

  • .sReturnThis - this value is "returned" to the above sReturnTOWindow and the variable must be declared in the Global Area of each internal window. 

 

Note: When returning or giving focus to another "embedded internal window" the UI tries to run a local procedure named UI_RefreshRequest and pass to it the .sReturnThis variable.

We can use this variable to automatically select an entry in a table - see the code in UI_RefreshRequest() of the IWB_Products window.