dynamic ADXRibbonContexmenu

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

dynamic ADXRibbonContexmenu
 
Gunther Herbsthofer




Posts: 20
Joined: 2006-12-24
I want to add Buttons dynamic to a contextmenue.
My source dosn't work and I could not find a propper sample.

Private Sub MenuCreate()
Dim IDX As Int16 = 0
Dim xmlKat As New XmlDocument
xmlKat.Load(HHOLDatei)
Dim HKL As XmlNodeList = xmlKat.SelectNodes("Root/Kategorien/Kategorie[@ADR='Archiv']/Kat")
For Each Node As XmlNode In HKL
NewCtrl = New AddinExpress.MSO.ADXRibbonButton(Me.components) With {
.Id = String.Format("{0:d2}-{1}", IDX, Node.Attributes("KAT").InnerText),
.Caption = Node.Attributes("KAT").InnerText,
.Glyph = Global.Herbsthofer.My.Resources.Resources.mail16
}
AddHandler NewCtrl.OnClick, AddressOf newCtrl_Onclick
smArchiv.Controls.Add(NewCtrl)
IDX += 1
Next
End Sub

mfg GH
Posted 26 Apr, 2020 12:14:15 Top
Andrei Smolin


Add-in Express team


Posts: 17438
Joined: 2006-05-11
Hello Gunther,

Make sure you have selected the check box that we describe in check section Get Informed about Errors in Ribbon markup; see the PDF file in the folder {Add-in Express}\Docs on your development PC.

Gunther Herbsthofer writes:
.Id = String.Format("{0:d2}-{1}", IDX, Node.Attributes("KAT").InnerText),


An Id must start with a symbol.

also, I suppose you should delete previously created controls before you add new ones.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Apr, 2020 04:39:12 Top
Gunther Herbsthofer




Posts: 20
Joined: 2006-12-24
Tahnk your for your fast help.
mfg GH
Posted 27 Apr, 2020 04:48:55 Top
Andrei Smolin


Add-in Express team


Posts: 17438
Joined: 2006-05-11
You are welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Apr, 2020 04:51:55 Top