Process Analyst Control

Hello all,

I want do add a new button in toolbar of the Process Analyst Control.

I have been looking at help to sse how it was done but i dont know how to do: "If necessary, enter a new ID for the command. This ID can be used in Cicode to determine which command has been triggered or to find a specific command in the Citect SCADA system."

Can anyone help?

Thanks a lot

Parents
  • You can find the built-in command IDs on the help page: Runtime Client Tools > Process Analyst > Customize Process Analyst > ICommand Interface

    If you want to create a button to trigger a built-in command, use one of those IDs, like "Citect_Command_ToggleVerticalScrollLock". Or, if you are creating your own command, make up your own command ID. The ICommandSystem.Create help page shows a sample custom ID like "Custom_CommandID1" and says it must not begin with "Citect_".

    Here's a code snippet I had from somewhere. Maybe it will get you started.

    //ToolbarButtonType_Push = 0 
    //ToolbarButtonType_Toggle = 1 
    //ToolbarButtonType_Separator = 2 
    PRIVATE INT FUNCTION CreateCustomCommandButton(OBJECT oPA, STRING sID, STRING sTooltip, OBJECT oToolbar, INT nButtonType = 0, INT nPrivilege = 0)
    	OBJECT	oCommandSystem;
    	OBJECT	oCommand;
    	OBJECT	oToolbarButtons;
    	STRING	sIconFile;
    	STRING	sCommandID = "Custom_Command_" + sID;
    	
    	ErrSet(1);
    	
    	oToolbarButtons = _ObjectGetProperty(oToolbar, "Buttons");
    	oCommandSystem = _ObjectGetProperty(oPA, "CommandSystem");
    	oCommand = _ObjectCallMethod(oCommandSystem,"get_ItemById", sCommandID);
    	
    	//Create command object if needed	
    	IF ObjectIsValid(oCommand) = FALSE THEN
    		sIconFile = PathToStr("[RUN]:" + sID + ".ico");
    		oCommand = _ObjectCallMethod(oCommandSystem, "Create", sCommandID, nButtonType, sTooltip, sIconFile, nPrivilege);
    	END
    	
    	//Add button to toolbar
    	IF ObjectIsValid(oCommand) = TRUE THEN
    		_ObjectCallMethod(oToolbarButtons, "Add", sCommandID);
    	END
    
    	RETURN IsError();
    END
    

    Your other option is to go to the Properties window and add the button through the user interface. If you save the view, the button will be saved as part of the view. If you don't use views or you have too many existing views to edit manually, then doing it through Cicode may be better.

    If you are creating a new custom command, you will have to create a Cicode function to run when the CommandExecuted event triggers. See the Runtime Client Tools > Process Analyst > Customize Process Analyst > CommandExecuted [Event] help page.

Reply
  • You can find the built-in command IDs on the help page: Runtime Client Tools > Process Analyst > Customize Process Analyst > ICommand Interface

    If you want to create a button to trigger a built-in command, use one of those IDs, like "Citect_Command_ToggleVerticalScrollLock". Or, if you are creating your own command, make up your own command ID. The ICommandSystem.Create help page shows a sample custom ID like "Custom_CommandID1" and says it must not begin with "Citect_".

    Here's a code snippet I had from somewhere. Maybe it will get you started.

    //ToolbarButtonType_Push = 0 
    //ToolbarButtonType_Toggle = 1 
    //ToolbarButtonType_Separator = 2 
    PRIVATE INT FUNCTION CreateCustomCommandButton(OBJECT oPA, STRING sID, STRING sTooltip, OBJECT oToolbar, INT nButtonType = 0, INT nPrivilege = 0)
    	OBJECT	oCommandSystem;
    	OBJECT	oCommand;
    	OBJECT	oToolbarButtons;
    	STRING	sIconFile;
    	STRING	sCommandID = "Custom_Command_" + sID;
    	
    	ErrSet(1);
    	
    	oToolbarButtons = _ObjectGetProperty(oToolbar, "Buttons");
    	oCommandSystem = _ObjectGetProperty(oPA, "CommandSystem");
    	oCommand = _ObjectCallMethod(oCommandSystem,"get_ItemById", sCommandID);
    	
    	//Create command object if needed	
    	IF ObjectIsValid(oCommand) = FALSE THEN
    		sIconFile = PathToStr("[RUN]:" + sID + ".ico");
    		oCommand = _ObjectCallMethod(oCommandSystem, "Create", sCommandID, nButtonType, sTooltip, sIconFile, nPrivilege);
    	END
    	
    	//Add button to toolbar
    	IF ObjectIsValid(oCommand) = TRUE THEN
    		_ObjectCallMethod(oToolbarButtons, "Add", sCommandID);
    	END
    
    	RETURN IsError();
    END
    

    Your other option is to go to the Properties window and add the button through the user interface. If you save the view, the button will be saved as part of the view. If you don't use views or you have too many existing views to edit manually, then doing it through Cicode may be better.

    If you are creating a new custom command, you will have to create a Cicode function to run when the CommandExecuted event triggers. See the Runtime Client Tools > Process Analyst > Customize Process Analyst > CommandExecuted [Event] help page.

Children
No Data