ADXBackstageDropDown Change Event broken if items added at runtime

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

ADXBackstageDropDown Change Event broken if items added at runtime
Office 2010 issue  
Peter Domke




Posts: 22
Joined: 2009-06-28
Office 2010 and Windows 7 with latest service packs,
Add-in Express 6.6.3059 Premium
Visual Studio 2010

I'm developing a Word 2010 add-in in which I need to rework/replace the Backstage tab for Printing with own controls to check the printer the user has selected while printing.
I'm reading the printers from the registry and populate a BackstageDropDown control with the values in the OnShow event of the backstage tab. I need the OnChange event to change the current printer to the selected one from the dropdown.

Unfortunately, the OnChange event is broken *if the items in the dropdown are added at runtime*. If I add them at design-time, the OnChange fires correctly.
I've started with a Combobox instead of a Dropdown. With a Combobox control, there is no difference, and the OnChange event fires correctly. But the Combobox cannot be set to "readonly" style, so the user may type in nonsense, so I changed it to a dropdown control.

I've sent a sample Word 2010 add-in reproducing the issue to the ADX support e-mail address referring to the subject of the topic.

It seems to be a bug in ADX. Please advise. If you have an idea of a workaround, it would be great.

Here's a screen shot of the backstage tab. On each change event, the label control below the dropdown or combobox should be updated with the selected value.
User added an image
Posted 12 Jan, 2012 13:51:13 Top
Eugene Astafiev


Guest


Hi Peter,

There is no bug. You just need to specify the Id property for all your backstage view controls. For example:

Private Sub FillDropDown1()
   Dim adxitem As AddinExpress.MSO.ADXBackstageItem
   Dim i As Integer
   With Me.AdxBackstageDropDown1.Items
       For i = 1 To 5
           adxitem = New AddinExpress.MSO.ADXBackstageItem
           adxitem.Caption = "BackstageItem - Dropdown " & i
           adxitem.Id = "adxBackstageItem_3c2d387ffa144f1fb2e58eb0f37cb61" + i.ToString()
           .Add(adxitem)
       Next
   End With
   Me.AdxBackstageDropDown1.SelectedItemIndex = 0
End Sub
Posted 13 Jan, 2012 08:52:04 Top
Peter Domke




Posts: 22
Joined: 2009-06-28
Thank you very much, Eugene,
I've just tried it out in my add-in and it works now like a charm. Great!
Peter
Posted 13 Jan, 2012 09:04:43 Top