What if I need to use the Tag Property

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

What if I need to use the Tag Property
 
NeilB4TheKing




Posts: 12
Joined: 2013-05-28
I understand that Add-in Express uses the Ribbon control TAG property for its internal use. I'm converting my VBA program to VSTO. What if I needed it to identify which button was pressed on a dynamically created button menu list. How do I do that?
Posted 30 May, 2013 01:31:19 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Neil,

NeilB4TheKing writes:
I understand that Add-in Express uses the Ribbon control TAG property for its internal use.


In no case! You can use the Tag property as required.

NeilB4TheKing writes:
What if I needed it to identify which button was pressed on a dynamically created button menu list. How do I do that?


In the event handler you can check control.Id:

private void adxRibbonButton1_OnClick(object sender, IRibbonControl control, bool pressed)
{    
    MessageBox.Show(control.Id);
}



Andrei Smolin
Add-in Express Team Leader
Posted 30 May, 2013 04:03:42 Top
NeilB4TheKing




Posts: 12
Joined: 2013-05-28
Thanks for your quick reply. Firstly, I'm new to VS and VB.NET and I am migrating my MS Excel VBA add-in to this new platform. When I try and set the Tag property on a control in the designer it only lets me enter numbers not text. In Excel VBA the Ribbon XML lets me enter text as a TAG.
Posted 30 May, 2013 05:49:24 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Oh, now I see. I confirm that AddinExpress.MSO.ADXRibbonCustomControl.Tag property is an integer while the tag attribute in the Ribbon schema is a string.

I suggest that you create a list containing the strings and use the Tag properties to store indexes for that list.

Still, to identify the control clicked, you use the Id property, not Tag.


Andrei Smolin
Add-in Express Team Leader
Posted 30 May, 2013 07:03:03 Top