Sets or gets the name of the macro or script to be run when the Receive event is triggered.
object.OnReceive = [string]
Where object is an object expression that evaluates to one of the controls in the Applies To list, and string is a string expression specifying the script or macro to run when the Receive event is triggered.
Newlook Smartclient
Newlook Server
The Receive event occurs every time a new screen is received from the host. When received, the Screen ID of a new screen is compared with the Screen ID of the existing screen. If they are the same, then a Refresh event is triggered, otherwise the Receive event is triggered.
This event is triggered after the screen has been received and the form has been created, but before the form is displayed.
Typically this property is used to include global or specific host form initialization. It may be used with a script that specifies default settings for controls, indicates content to be loaded into a combo box or list box control and/or initializes variables used in the form.
When you create macros or scripts for related events, such as Activate and GotFocus, be sure that their actions don't conflict and that they don't cause recursive events.
If you wish to run the same macro or script every time a screen is received from the host then assign a macro/script to the OnReceive and OnRefresh properties of the App object in your Startup macro.
The following lines in the Startup macro will cause the macro titled "HostFormInitialization" to run every time a form is received from the host, regardless if it is an update or new form:
SetValue App.OnReceive "HostFormInitialization"
SetValue App.OnRefresh "HostFormInitialization"
Added forms do not support the OnReceive property. Therefore if you are assigning logic to the OnReceive property of the App object at startup be aware that this logic will not run when added forms are loaded at runtime. Use the OnOpen property to achieve similar functionality for added forms.
If you wish to run a specific macro or script for an individual host form/s then assign a macro/script to the OnReceive property of the Form object of your chosen host form.
When a macro or script is assigned to both the App object and the Form object then the macro/script assigned to the OnReceive property of the form will run before the macro assigned to the App object.
OnRefresh property | OnSend property
© 2004-2021 looksoftware. All rights reserved.