ESPL: AlertEvent( eSave )

Q:  Is there a way to differentiate between the 3 different events that fire the AlertEvent(eSave) processing?

The 3 possible events are:

a) the user closes the chart.
b) the Timeframe button is used to change the chart but the chart form is the same.
c) the data for the chart is refreshed.

In the first two cases, I want to perform my CloseChart processing, i.e. save the chart data to file and close the MainForm instance.   In the second case, a new MainForm instance will be created by the subsequent eLoad event.

In the third case, it is possible that new bars have been added before the barend. In this case, the appropriate action is to reinitialize so that processing begins from the start but I don’t want to save the data to file and close the instance.

A:   Ensign 10 ESPL splits out all the places the AlertEvent(eSave) is called and identifies the procedure in the IT variable’s string.   The possible places for saving chart datafile are many. The IT text will have the time, then Save and a word for the procedure, and then the symbol. You can use

if pos('Save Close',IT)>0 then begin 
  {this is case a) for chart close} 
end;

Other choices for xxx in ‘Save xxx’ are:   Roll, Build, Objects, Open, Close, Rebuild, Template, Property, Timer, Load, Refresh, ESPL 1, ESPL 2, ESPL 3, Update, and Time.

The 3 events you asked about would be: 

a) Save Close
b) Save Time
c) Save Refresh

Of course, put in some logging of the IT value to the output window and verify the content of IT for the various actions you take and the program exercises and skip those that do not affect your system design.   

Example test code:

begin
  if ESPL=0 then AlertEvent(eSave, 600);
  if ESPL=600 then writeln( IT );
end;