I want pre approval pop up when I press any command in Citect SCADA 2018 R2

hello everyone! I want pre approval pop up when I press any command. but i can not able to get the results. I am using YES_NO Function. Can anyone help me. It's urgent. Thanks in advance.

Parents Reply
  • Basically, I am using Citect SCADA and I have commands buttons like open close commands and auto manual mode commands. 

    what I want:

    once i will press any button for the command it should show me popup for approval. It will be best for me if citect scada has built in function for that. If not you can provide me with other function or script.

    Whereas, I was using YES_NO Function which is built in function in citect SCADA.

    Thanks

Children
  • You could use the built-in Message() Cicode function. It doesn't do Yes/No, but it does have OK and Cancel buttons. It returns 0 if they click OK. So, to use it on a button, set the button command like:

    IF Message("title text", "prompt message", 1+32) = 0 THEN
      commands if they click OK
    ELSE
      commands if they click Cancel
    END

    The 1+32 argument tells it to display OK and Cancel buttons and a question mark icon. See the Message Function help page for details.

    The other option is you could use the Formxxx functions to create your own custom form with Yes/No buttons or whatever you want. It is more work than using the Message function. See the Form Functions help page. Start with the FormNew() function.

    For example, here is a form function I created that works like the Input() function so I could control the size and position:

    //Display an input form similar to the Input() function, positioned near the current mouse coordinates
    //Returns the value entered by the user or sDefault if the user clicked Cancel.
    //Sets an error if the user didn't select OK.
    STRING FUNCTION InputForm(STRING sTitle, STRING sPrompt, STRING sDefault)
    	INT		cOkButton = 1;
    	INT		cCancelButton = 2;
    	INT		cEditBox = 1;
    	
    	INT 	hForm;
    	INT 	iWidth = Max(StrLength(sTitle), 24);
    	INT 	iHeight = 3;
    	INT 	iMode = 8;
    	INT		x, y;
    	STRING	sInputBuffer = sDefault;
    	INT		nError;
    	INT		nPromptLen;
    	INT		nLinefeedChar;
    	
    	DspGetMouse(x, y);
    	
    	//If prompt longer than current width, increase width to fit
    	//If prompt has multiple lines, use length of first line
    	nLinefeedChar = StrSearch(0, sPrompt, "^n");
    	IF nLinefeedChar = -1 THEN
    		nPromptLen = StrLength(sPrompt);
    		iWidth = Max(iWidth, nPromptLen);
    	ELSE
    		iWidth = Max(iWidth, nLinefeedChar);
    	END
    	
    	hForm = FormNew(sTitle, iWidth, iHeight, iMode);
    	FormPrompt(0, 0, sPrompt);
    	FormField(0, 1, iWidth, 1, cEditBox, sInputBuffer, "", 0);
    	FormButton(iWidth - 15, 2, "Cancel", 0, cCancelButton);
    	FormButton(iWidth - 7, 2, "  OK  ", 0, cOKButton);
    	FormPosition(x + 20, y + 20, 0);
    	nError = FormRead(0)
    
    	IF nError = 0 THEN
    		RETURN sInputBuffer;
    	ELSE
    		ErrSetHw(-1, nError);
    		RETURN sDefault;
    	END
    END
    
  • Thanks dear, I have tried above first solution it's working.

    No words to thanks you.