Custom Labeling Expression Property Page

808
1
06-01-2012 07:38 AM
JillianStanford
Occasional Contributor III
Hi Forum,
I've just converted this sample to VB.Net for Arc 10 -> One To Many Labels

It went fairly smoothly but I have two questions:

1. How can I get a hold of the property page that is currently active in the property sheet? What I really want to do is determine whether or not my custom property page is the one that's visible. I know I can get the currently active index from the property sheet but how I can I tell which page that is? Is there a way to get an enum of the property pages in a property sheet?

2. The sample adds a new annotation expression engine to the labeling expression page. In the 9.3 sample an entry is added to the "Parser" dropdown selector with the name of the new engine, so that it can be selected by the user. In my converted project the parser is added to the dropdown and functions correctly but it's blank - the name doesn't appear. My custom parser implements the IAnnotationExpressionEngine interface and correctly implements the Name property. I can see it's set when I'm debugging. In 10, what property is used to display the name of the new parser? Here's the code for the property:

Private ReadOnly Property Name() As String Implements ESRI.ArcGIS.Carto.IAnnotationExpressionEngine.Name
        Get
            On Error GoTo ErrHand
            Name = "One To Many"

            Exit Property
ErrHand:
            MsgBox("IAnnotationExpressionEngine_Name - " & Err.Description)
        End Get
    End Property


Many thanks for any suggestions you have,

Jill
0 Kudos
1 Reply
NileshShinolikar
New Contributor
Hi Jillian,


The Custom Parser Name should be registered with the " ESRI.ArcGIS.ADF.CATIDs.AnnotationExpressionParsers " category.
The component category registration code is  missing in the "OneToMayLabels" class
You need to add  the below code snippet which register the Custom parser in the 'ESRI Mx Annotation Expression Parsers' category

#Region "COM Registration Function(s)"
    <ComRegisterFunction(), ComVisibleAttribute(False)> _
    Public Shared Sub RegisterFunction(ByVal registerType As Type)
        ' Required for ArcGIS Component Category Registrar support
        ArcGISCategoryRegistration(registerType)

        'Add any COM registration code after the ArcGISCategoryRegistration() call

    End Sub

    <ComUnregisterFunction(), ComVisibleAttribute(False)> _
    Public Shared Sub UnregisterFunction(ByVal registerType As Type)
        ' Required for ArcGIS Component Category Registrar support
        ArcGISCategoryUnregistration(registerType)

        'Add any COM unregistration code after the ArcGISCategoryUnregistration() call

    End Sub

#Region "ArcGIS Component Category Registrar generated code"
    ''' <summary>
    ''' Required method for ArcGIS Component Category registration -
    ''' Do not modify the contents of this method with the code editor.
    ''' </summary>
    Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
        Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
        ESRI.ArcGIS.ADF.CATIDs.AnnotationExpressionParsers.Register(regKey)


    End Sub
    ''' <summary>
    ''' Required method for ArcGIS Component Category unregistration -
    ''' Do not modify the contents of this method with the code editor.
    ''' </summary>
    Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
        Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)

        ESRI.ArcGIS.ADF.CATIDs.AnnotationExpressionParsers.Unregister(regKey)

    End Sub

#End Region


You may need to Import  ESRI.ArcGIS.ADF.CATIDs and  System.Runtime.InteropServices in the respective class.

After making the changes you can build and run the sample application and you will be able to see the Custom parser name listed in the dropdown.


Hope this helps.


Nilesh Shinolikar.
GIS SDK Analyst
0 Kudos