Applies To:
  • CitectSCADA 1.20, 2.00, 2.01

Summary:
If the user presses the Cancel button after calling the Input function, the return value is an empty string. How can I tell if the user pressed the Cancel button or just entered an empty string? 

Solution:

When the user presses the Cancel button after calling the Input function, it will return an empty string and the current error is set to 299 (Command Cancelled). To test for this condition call the IsError function.  For example:

    sMyString = Input("Shutdown", "Do You Wish to Shut Project Down?", "Yes");
    IF IsError() = 299 THEN  
        ! operator pressed Cancel button
    ELSE  
        ! operator pressed OK button
    END

Or the operator can call the following command line:

    iSetPoint = StrToValue(Input("Input", "Input Value", iSetPoint));

This way, if an operator hits Cancel (i.e. by mistake), the command is aborted and the original value is not changed. That is why the 'Command Cancelled' (error code 299) hardware alarm will still be generated. 


Keywords:
 

Attachments