QuickOPC User's Guide and Reference
OPC-A&E Category Dialog
Features > User Interface > OPC Common Dialogs > OPC-A&E Common Dialogs > OPC-A&E Category Dialog
In This Topic

General

Icon:

With AECategoryDialog, your application can integrate a dialog box from which the user can select from OPC-A&E event categories provided by the OPC server:

The MultiSelect property determines whether the dialog allows the user to select multiple categories as output. The EventTypes property determines which event type(s) will be offered for selection.

Use the ServerDescriptor property to specify the OPC Alarms&Events server whose categories are to be browsed, and call the ShowDialog method. If the result is equal to DialogResult.OK, the user has finished the selection, and information about it can be retrieved.

When the dialog is in single-select mode, you can obtain the information about the selected category from the CategoryElement or CategoryId property. When the dialog is in multi-select mode, the information about the selected categories is in the CategoryElements and CategoryIds properties.

Example

// This example shows how to let the user browse for an OPC Alarms&Events condition available on a specified event category.

using System.Windows.Forms;
using OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing;

namespace FormsDocExamples._AECategoryConditionDialog
{
    static class ShowDialog
    {
        public static void Main1(IWin32Window owner)
        {
            var categoryConditionDialog = new AECategoryConditionDialog()
            {
                ServerDescriptor = {ServerClass = "OPCLabs.KitEventServer.2"},
                CategoryId = 0x00EC0002  // Deviation
            };

            DialogResult dialogResult = categoryConditionDialog.ShowDialog(owner);
            if (dialogResult != DialogResult.OK)
                return;

            // Display results
            MessageBox.Show(owner, $"ConditionElement: {categoryConditionDialog.ConditionElement}");
        }
    }
}
# This example shows how to let the user browse for an OPC Alarms&Events condition available on a specified event
# category.

# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from System.Windows.Forms import *
from OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing import *


categoryConditionDialog = AECategoryConditionDialog()
categoryConditionDialog.ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"
categoryConditionDialog.CategoryId = 0x00EC0002  # Deviation

dialogResult = categoryConditionDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
    exit()

# Display results.
print('ConditionElement: ', categoryConditionDialog.ConditionElement, sep='')

 

Advanced

If you want to change the parameters of the client object the component uses to perform its OPC operations, you can use the ClientSelector Property.

 

See Also

Examples - User Interface