Page 1 of 1

Detecting a form "unload" OR detecting "Back"

Posted: Fri Dec 13, 2013 1:25 am
by MarcusLancaster
Hi all.

In a form I can perform an action / run a script when a form loads by using something like this;

#com_Owner.Set Property('/Form.OnLoad.Operation.Type') To('ShowMessage')
#com_Owner.Set Property('/Form.OnLoad.Operation.Message') To('Form has Loaded')

So... I wonder... is there a way to detect a form closing / unloading? Or is there a way for me to detect when the user presses "Back". So in a similar way to onload, I'd like to show a message or run a script when the user presses the "Back" button before the form actually disappears.

Cheers.

Marcus.

Re: Detecting a form "unload" OR detecting "Back"

Posted: Fri Dec 13, 2013 9:00 am
by tsupartono
Marcus,
You can define your own "Back" command (using LongRange Studio).

In your Form View (either online/local form), define your commands as usual.
Designate a command as your "Back" button as per screenshot below.
Screen.PNG
Screen.PNG (51.7 KiB) Viewed 2414 times
You then need to set the operation to be performed for that command (using the System.Menus.XXXXX) where XXXXX is the symbolic name of the menu item as defined in Studio (cmdBackToOrderList in example above).

You can get the "back command" to execute an ECL piece.
To close the form, perform "CloseForm" operation at the end of the ECL (make sure you don't end the ECL with $apply)

Any problems let us know.