ADXOlFormsCollectionItem.Enabled problem with ADX.NET 2007 release

Add-in Express™ Support Service
That's what is more important than anything else

ADXOlFormsCollectionItem.Enabled problem with ADX.NET 2007 release
 
Thanasis Boukouvalas




Posts: 40
Joined: 2006-06-17
Hi

In my addin I have a folder subpane form and if I set Me.AdxOlFormsManager1.Items(0).Enabled=False and then I set it back to true (I want the visibility of pane to depend on the current selected mail), the pane does not be visible again.

This problem is an old one. I met it in the past and at some version it was fixed. Now, with 2007 release is came back.
Posted 12 Jan, 2007 09:59:43 Top
Fedor Shihantsov


Guest


Hi Thanasis,

The changing the ADXOlFormsCollectionItem.Enabled property removes all form instances creating by the ADXOlFormsCollectionItem advisedly.

You can use ADXOlFormsCollectionItem.FormInstances and ADXOlFormsCollectionItem.FormInstanceCount properties for accessing to forms.

Also you can use the ADXOlForm.Hide and ADXOlForm.Show methods.
See sample that shows a form if Subject is not empty.

    Private Sub adxOutlookEvents_ExplorerSelectionChange(ByVal sender As System.Object, ByVal explorer As System.Object) Handles adxOutlookEvents.ExplorerSelectionChange
        Dim selection As Outlook.Selection = Nothing
        Dim expl As Outlook.Explorer = OutlookApp.ActiveExplorer
        If (expl IsNot Nothing) Then
            selection = expl.Selection
            If (selection.Count > 0) Then
                Dim mailItem As Outlook.MailItem = TryCast(selection.Item(1), Outlook.MailItem)
                If (mailItem IsNot Nothing) Then
                    If mailItem.Subject = "" Then
                        HideTheForm()
                    Else
                        ShowTheForm()
                    End If
                End If
            End If
        End If
        If (selection IsNot Nothing) Then
            Marshal.ReleaseComObject(selection)
        End If
        If (expl IsNot Nothing) Then
            Marshal.ReleaseComObject(expl)
        End If
    End Sub

    Private _theForm As AddinExpress.OL.ADXOlForm = Nothing
    Public ReadOnly Property TheForm() As AddinExpress.OL.ADXOlForm
        Get
            If (_theForm Is Nothing) Then
                Dim i As Integer
                For i = 0 To AdxOlFormsCollectionItem1.FormInstanceCount - 1
                    If (AdxOlFormsCollectionItem1.FormInstances(i).Visible) Then
                        _theForm = AdxOlFormsCollectionItem1.FormInstances(i)
                    End If
                Next i
            End If
            Return _theForm
        End Get
    End Property

    Private Sub HideTheForm()
        If (TheForm IsNot Nothing) Then
            TheForm.Hide()
        End If
    End Sub

    Private Sub ShowTheForm()
        If (TheForm IsNot Nothing) Then
            TheForm.Show()
        End If
    End Sub

    Private Sub AdxOlFormsManager1_ADXBeforeFolderSwitchEx(ByVal sender As System.Object, ByVal args As AddinExpress.OL.BeforeFolderSwitchExEventArgs) Handles AdxOlFormsManager1.ADXBeforeFolderSwitchEx
        _theForm = Nothing
    End Sub


Please, let me know if you could not resolve your task of visibility.

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 13 Jan, 2007 11:13:45 Top