OPC Studio User's Guide and Reference
AECategoryDialog Class
Members  Example 



OpcLabs.EasyOpcForms Assembly > OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing Namespace : AECategoryDialog Class
Displays a dialog box from which the user can select from OPC-A&E event categories provided by the OPC server.
Object Model
AECategoryDialog ClassAECategoryElement ClassAECategoryElementCollection ClassAECategoryElement ClassEasyAEClientSelector ClassAEEventType ClassAEEventType ClassServerDescriptor Class
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AECategoryDialog)>
<ComVisibleAttribute(True)>
<GuidAttribute("B1C4D316-08D7-4CC0-88CC-979AE1455736")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<DesignerCategoryAttribute("Component")>
Public NotInheritable Class AECategoryDialog 
   Inherits AEDialog
   Implements OpcLabs.BaseLib.Forms.ComTypes._FormCommonDialog, OpcLabs.BaseLib.Forms.ComTypes._SizableCommonDialog, OpcLabs.BaseLib.Licensing.ILicensingContextHolder, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AECategoryDialog, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEDialog, System.ComponentModel.IComponent, System.IDisposable 
'Usage
 
Dim instance As AECategoryDialog
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AECategoryDialog)]
[ComVisible(true)]
[Guid("B1C4D316-08D7-4CC0-88CC-979AE1455736")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[DesignerCategory("Component")]
public sealed class AECategoryDialog : AEDialog, OpcLabs.BaseLib.Forms.ComTypes._FormCommonDialog, OpcLabs.BaseLib.Forms.ComTypes._SizableCommonDialog, OpcLabs.BaseLib.Licensing.ILicensingContextHolder, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AECategoryDialog, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEDialog, System.ComponentModel.IComponent, System.IDisposable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AECategoryDialog)]
[ComVisible(true)]
[Guid("B1C4D316-08D7-4CC0-88CC-979AE1455736")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[DesignerCategory("Component")]
public ref class AECategoryDialog sealed : public AEDialog, OpcLabs.BaseLib.Forms.ComTypes._FormCommonDialog, OpcLabs.BaseLib.Forms.ComTypes._SizableCommonDialog, OpcLabs.BaseLib.Licensing.ILicensingContextHolder, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AECategoryDialog, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEDialog, System.ComponentModel.IComponent, System.IDisposable  
Remarks

This is a modal dialog box; therefore, when shown, it blocks the rest of the application until the user has made a selection. When a dialog box is displayed modally, no input (keyboard or mouse click) can occur except to objects on the dialog box. The program must hide or close the dialog box (usually in response to some user action) before input to the calling program can occur.

 

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

.NET

// This example shows how to let the user browse for an OPC Alarms&Events condition available on a specified event category.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

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.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing

Namespace FormsDocExamples._AECategoryConditionDialog
    Friend Class ShowDialog
        Shared Sub Main1(owner As IWin32Window)
            Dim categoryConditionDialog = New AECategoryConditionDialog() With {
                .ServerDescriptor = New ServerDescriptor() With {
                    .ServerClass = "OPCLabs.KitEventServer.2"
                },
                .CategoryId = &HEC0002 ' Deviation
            }

            Dim dialogResult As DialogResult = categoryConditionDialog.ShowDialog(owner)
            If dialogResult <> DialogResult.OK Then
                Return
            End If

            ' Display results
            MessageBox.Show(owner, $"ConditionElement: {categoryConditionDialog.ConditionElement}")
        End Sub
    End Class
End Namespace

Python

# This example shows how to let the user browse for an OPC Alarms&Events condition available on a specified event
# category.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# 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.

 

 

Example
// This example shows how to let the user browse for OPC Alarms&Events categories. 
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

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

namespace FormsDocExamples._AECategoryDialog
{
    static class ShowDialog
    {
        public static void Main1(IWin32Window owner)
        {
            var categoryDialog = new AECategoryDialog
            {
                ServerDescriptor = {ServerClass = "OPCLabs.KitEventServer.2"}
            };

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

            // Display results
            string categoryElementsString = string.Join("\n", categoryDialog.CategoryElements.Select(element => element));
            MessageBox.Show(owner, categoryElementsString);
        }
    }
}
' This example shows how to let the user browse for OPC Alarms&Events categories.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing

Namespace FormsDocExamples._AECategoryDialog
    Friend Class ShowDialog
        Shared Sub Main1(owner As IWin32Window)
            Dim categoryDialog = New AECategoryDialog() With {
                .ServerDescriptor = New ServerDescriptor() With {
                    .ServerClass = "OPCLabs.KitEventServer.2"
                }
            }

            Dim dialogResult As DialogResult = categoryDialog.ShowDialog(owner)
            If dialogResult <> DialogResult.OK Then
                Return
            End If

            ' Display results
            Dim categoryElementsString As String = String.Join("\n", categoryDialog.CategoryElements.Select(Function(element As AECategoryElement) element))
            MessageBox.Show(owner, categoryElementsString)
        End Sub
    End Class
End Namespace
# This example shows how to let the user browse for OPC Alarms&Events categories.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# 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 *


categoryDialog = AECategoryDialog()
categoryDialog.ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"

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

# Display results.
print()
for categoryElement in categoryDialog.CategoryElements:
    print(categoryElement)
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Windows.Forms.CommonDialog
            OpcLabs.BaseLib.Forms.ConcreteCommonDialog
               OpcLabs.BaseLib.Forms.FormCommonDialog
                  OpcLabs.BaseLib.Forms.SizableCommonDialog
                     OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.AEDialog
                        OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.AECategoryDialog

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also