HEScript scripts such as UserMain contain pre-defined events, i.e. functions which are called by the application at appropriate times.
In this topic we will describe these events.
The UserMain script is a script that is always created when a new project is started. It contains a lot of global events which allow you to insert special commands.
|function OnBeforeNavigate (NewURL, TargetFrame: String): Boolean;||Triggered just before the application is going to display an HTML page. Set Result to True to stop the operation. NewURL is the full URL that will be displayed, and TargetFrame the frame where the page is displayed (if any).|
|function OnRouterURL(RequestedURL, RequestedFilename, PathInfo, QueryString: String): String;||Triggered by the router engine: lets you reroute any URL. Further decription and samples.|
|procedure OnPHPErrorMessage(ErrorMsg: String);||When an error is returned by the PHP runtime. ErrorMsg contains the error message.|
|procedure OnNavigateComplete (URL: String);||When a page has been loaded. URL is the full URL of this page.|
|function OnPubLoaded: Boolean;||When the application is starting and before the homepage is displayed. Set Result to True if you want to exit immediately without any warning.|
|procedure OnPubBeingClosed;||When the application is going to be terminated.|
|procedure OnDisplayWindow (WindowName: String);||When a window (whose name is indicated in WindowName) is displayed. Works for the main and secondary windows like pop-ups.|
|procedure OnStartMainWindow;||When the main window is going to be displayed (just before the homepage is shown).|
|procedure OnCloseWindow (WindowName: String);||When a window is closed by the user.|
|function OnWindowCloseQuery (WindowName: String): Boolean;||When a user wants to close a window. Set Result to False if you do not want the window to close or True if the window can close. This event is not created by default. You will need to add it manually to the UserMain script of your project if you want to use it.|
|function OnTimer (TimerName: String): Boolean;||This event is triggered by a timer created by StartTimer HEScript function. Occurs when a specified amount of time, determined by StartTimer HEScript function, has passed. Set the result of this function to True if you want to disable the timer or use StopTimer to disable the timer.|
|procedure OnPrintPage;||When the current page is being printed by the user.|
|function OnInvalidPasswordAtStartup: Boolean;||Occurs when an invalid global password is provided at startup. Note: set to True if you want the application NOT to display an error message and exit.|
|function OnExpiredPublication: Boolean;||Occurs when the global expiration date is reached. Note: set to True if you want the application NOT to display an error message and exit.|
|procedure OnTrayIconClick;||The user clicks the tray icon.|
|procedure OnTrayIconDblClick;||The user double-clicks the tray icon.|
Introduction to Scripting
Using the Script Manager
Script Function Reference