KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Determine if the Form Window was Closed with the Close Button
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: March 23, 2020

Similar to the CANCEL command, closing a form window with the title bar red close button sets the OK variable to 0. This is a potential way to determine whether the form window was closed with the red 'x' close button.

(Mac)

(Win)

Code can be added to the method that called the Open form window command to check if the OK variable is set to 0. If the red 'x' close button was used to close the form, the code inside the If statment will execute.

$win:=Open form window("Form_Name")
DIALOG("Form_Name")
CLOSE WINDOW($win)

If (OK=0)
  ...
End if