none
Buttons with qualified ID do not fire onAction event RRS feed

  • Question

  • I have following ribbon XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" xmlns:cns="http://schemas.mycompany.com/office/2014/11/customui/workspaces" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idQ="cns:TabWorkspaces" label="WORKSPACES">
            <group idQ="cns:GroupOpen" label="Open" autoScale="true">
              <button idQ="cns:ButtonOpenFromWorkspace" imageMso="OpenSpecificFile" size="large" label="Open from workspace" onAction="ButtonOpenFromWorkspace_OnAction" />
              <button idQ="cns:ButtonSearchWorkspace" imageMso="SearchUpscopeToAllItemsOfType" size="large" label="Search" onAction="ButtonSearchWorkspace_OnAction" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
    

    Somehow the events onAction are not raised. Maybe other events / callbacks like getLabel, getDescription, etc. are not loaded, too. I did not test it.

    The event will be raised if the button definitions are replaced with this piece of XML:

              <button id="ButtonOpenFromWorkspace" imageMso="OpenSpecificFile" size="large" label="Open from workspace" onAction="ButtonOpenFromWorkspace_OnAction" />
              <button id="ButtonSearchWorkspace" imageMso="SearchUpscopeToAllItemsOfType" size="large" label="Search" onAction="ButtonSearchWorkspace_OnAction" />
    

    How can I use qualified IDs for buttons such that the events are raised?

    Tuesday, September 1, 2015 4:30 PM

Answers

  • Hi Yavuz,

    >> Somehow the events onAction are not raised. Maybe other events / callbacks like getLabel, getDescription, etc. are not loaded, too.

    The id and idQ are different. Id specifies the identifier for a custom control, and idQ specifies a qualified identifier for a control. The idQ attribute is used to reference controls or containers created by other custom ui documents. Based on your ribbon xml, I assume that it was caused by that your cns namespace prefix is not set to the Custom UI namespace.

    >> How can I use qualified IDs for buttons such that the events are raised?

    Do you need to reference controls by other custom UI documents? If not, I suggest you use id. If you need, you need to set the custom ui namespace. You could refer the link below for more details.

    # 2.3.9 ST_QID (Qualified Control ID)
    https://msdn.microsoft.com/en-us/library/dd908788(v=office.12).aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Marked as answer by Yavuz T Tuesday, September 8, 2015 9:02 AM
    Wednesday, September 2, 2015 2:45 AM
  • Hi Yavuz

    Yes, you should use id instead of idQ for the buttons. Sharing buttons would present problems (which onAction should be executed?), while tabs and groups can, so idQ doesn't make sense for buttons. And if the groups won't be shared, don't use idQ for them, either.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Yavuz T Tuesday, September 8, 2015 9:02 AM
    Thursday, September 3, 2015 5:08 PM
    Moderator

All replies

  • Hi Yavuz,

    >> Somehow the events onAction are not raised. Maybe other events / callbacks like getLabel, getDescription, etc. are not loaded, too.

    The id and idQ are different. Id specifies the identifier for a custom control, and idQ specifies a qualified identifier for a control. The idQ attribute is used to reference controls or containers created by other custom ui documents. Based on your ribbon xml, I assume that it was caused by that your cns namespace prefix is not set to the Custom UI namespace.

    >> How can I use qualified IDs for buttons such that the events are raised?

    Do you need to reference controls by other custom UI documents? If not, I suggest you use id. If you need, you need to set the custom ui namespace. You could refer the link below for more details.

    # 2.3.9 ST_QID (Qualified Control ID)
    https://msdn.microsoft.com/en-us/library/dd908788(v=office.12).aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Marked as answer by Yavuz T Tuesday, September 8, 2015 9:02 AM
    Wednesday, September 2, 2015 2:45 AM
  • Hi Edward,

    the tab is referenced by other custom UI document. I have two add ins. Both of them schould show groups and buttons in the same tab. Therefore the idQ attribute for the tab.

    Buttons and groups in the two add ins are distinct from each other. So you are suggesting that I schould use for the buttons the id attribute?

    Best Regards,

    Yavuz

    Wednesday, September 2, 2015 7:42 AM
  • Hi Yavuz

    Yes, you should use id instead of idQ for the buttons. Sharing buttons would present problems (which onAction should be executed?), while tabs and groups can, so idQ doesn't make sense for buttons. And if the groups won't be shared, don't use idQ for them, either.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Yavuz T Tuesday, September 8, 2015 9:02 AM
    Thursday, September 3, 2015 5:08 PM
    Moderator
  • Hi Cindy,

    I'm experiencing an issue with this. I have the same setup and issue as detailed above.

    I have a VBA addin that i have the master ribbon/customui in.

    I have other addins that need to add controls to the same ribbon, but these controls need to be added at specific locations.

    I set idQ on all controls in the master so that the other addins can successfully utilise insertBeforeQ and insertAfterQ and insert their controls in the correct locations.

    The ribbon and all controls load successfully.

    None of the onAction events fire for any of the buttons that use idQ. I haven't tested any other control event.

    The documentation states...

    "If you use a COM add-in to customize the Fluent UI, the namespace name must be the ProgID of the COM add-in, but the behavior is otherwise the same. When you use a shared add-in, the ProgID is AddInName.Connect. When you use Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System (Visual Studio 2005 Tools for Office Second Edition) to create the add-in, the ProgID is the name of the add-in."

    But my addin is a regular .dotm. What should I use as the namespace here? I've tried the file name, the VBA Project name... still no onAction.

    Edward's comment uses the word "assume", so I can discount any help there as he clearly hasn't tested this.

    Can you point me in the right direction as to how to use idQ on button controls, allowing other controls to utilise insertBeforeQ and still have those button controls work correctly in VBA please?

    Thanks

    Matt

    Wednesday, February 6, 2019 5:15 PM