Accessing controls in Ribbon

Jun 8, 2012 at 5:45 PM

Can anybody help me, please? I am trying to figure out how to access the controls in Ribbon UI.

I create a custom tab and add some controls to it, like this:

<?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="" onLoad="OnLoad">
      <tab id="myTab" label="My Tab">
        <group id="group1" label="IO">
           <button id="Action" size="large" onAction="OnAction" />
          <comboBox id="selector" getItemCount="GetItemCount" getItemLabel="GetItemLabel" onChange="OnChange" maxLength="50" getText="GetText" />

 I create the necessary callback functions OnAction, GetItemCount, etc. Now, when I press the button "Action" I would like to be able to access the combo box "selector" and do something based on the current value I find there. However, I am at loss how to get it. I can store the string RibbonID I get in GetCustomUI() and IRibbonUI I get in OnLoad(), but I do not know how to get a reference to the Ribbon itself or to its Controls collection.

I am able to circumvent the problem by keeping the track of the combo box state in the OnChange function, however it seems quite inelegant.

I would be thankful for any hint.

Jun 10, 2012 at 8:41 AM


a typical workarround is, store the the current selected index in a global local variable in OnChange/GetPressed and use them in OnAction.
btw: the DropDown control looks a little bit more flexibel.