Example: Constructing Visual Basic property pages for a property sheet handler

Property pages that are implemented by iSeries™ Navigator Visual Basic plug-ins can not use a registry key to specify property pages. You must add a specific property page context menu item in your ListManager class to implement a property page. You can not add a property page to any existing property sheet objects.

In the Visual Basic Sample plug-in, a property page is supported for Libraries in the iSeries Navigator List. This is done with the following steps:
  1. In listman.cls, the Library object type specifies a properties page in the getAttributes method:
    ' Returns the attributes of an object in the list.
    Public Function ListManager_getAttributes(ByVal item As Object) As Long
        Dim uItem As ItemIdentifier
        Dim nAttributes As ObjectTypeConstants
        
        If Not IsEmpty(item) Then
            Set uItem = item
        End If
        
        If uItem.getType = "SampleVBFolder" Then
            nAttributes = OBJECT_ISCONTAINER
        ElseIf item.getType = "SampleLibrary" Then
            nAttributes = OBJECT_IMPLEMENTSPROPERTIES
        Else
            nAttributes = 0
        End If
        
        ListManager_getAttributes = nAttributes
    End Function
  2. In actnman.cls, the queryActions method specifies that properties should be shown on the Library object context menu.
    Public Function ActionsManager_queryActions(ByVal flags As Long) As Variant
            .
            .
     
            ' Add menu items to a Sample Library
            If selectedFolderType = "SampleLibrary" Then
                 ' Standard Actions
                 If (flags And STANDARD_ACTIONS) = STANDARD_ACTIONS Then
                       ReDim actions(0)
            
                       ' Properties
                       Set actions(0) = New ActionDescriptor
                       With actions(0)
                             .Create
                             .setID IDPROPERTIES
                             .SetText m_uLoader.getString(IDS_ACTIONTEXT_PROPERTIES)
                             .setHelpText m_uLoader.getString(IDS_ACTIONHELP_PROPERTIES)
                             .setVerb "PROPERTIES"
                             .setEnabled True
                             .setDefault True
                       End With
        
                       ' Properties is only selectable if there is ONLY 1 object selected
                       If Not IsEmpty(m_ObjectNames) Then
                            If UBound(m_ObjectNames) > 0 Then
                                 actions(2).setEnabled False
                            End If
                       End If
                   End If
            End If
            .
            .
    End Function
  3. In actnman.cls, the actionsSelected method displays a properties form when the properties context menu is selected.
    Public Sub ActionsManager_actionSelected(ByVal action As Integer, ByVal owner As Long)
        .
        .
        Select Case action
            .
            .
            Case IDPROPERTIES
                If (Not IsEmpty(m_ObjectNames)) Then
                    ' Pass the System Name into a hidden field on the form for later use
                    frmProperties.lblSystemName = m_ObjectNames(0).getSystemName
                    
                    ' Pass the Display Name of the selected object into a hidden field on the form
                    frmProperties.lblLibName = m_ObjectNames(0).getDisplayName
                                    
                    ' Show the properties
                    frmProperties.Show vbModal
                End If
            .
            .
            Case Else
                'Do Nothing
        End Select
     
       .
    End Sub     
Note: The code to create and display the property sheet can be seen in propsht.frm