Solved

Display Contextual Ribbon at the end of a Custom Ribbon

Posted on 2014-10-21
7
345 Views
Last Modified: 2014-11-04
Hi,

     I have an Access application that uses a Custom Ribbon (created from an XML file).  The Access Ribbon isn't displayed at all.  I also have a Custom Contextual Ribbon (also created from an XML file) that is displayed when a few of the forms have the focus.  

    The displaying of the Custom Ribbon works perfectly and the Contextual Ribbon is displayed when the special forms have the focus.  However, the Custom Ribbon disappears when the Contextual Ribbon is displayed.  I would like the Contextual Ribbon to show up at the end of the main application Custom Ribbon.

     Here is the beginning of the XML file for the Contextual Ribbon.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <ribbon>
    <contextualTabs>

      <tabSet idMso="TabSetFormReportExtensibility">
     
        <tab id="My Contextual Tab" label="Special">

     I'm at a loss of how to make the Contextual tab show up at the end of the main custom Ribbon.

     Any thoughts?

Thanks,
Mike
0
Comment
Question by:Data-Man
  • 3
  • 3
7 Comments
 
LVL 84
ID: 40396572
I was of the impression that Contextual ribbons are shown to the right of the "main" ribbons. See this:

http://office.microsoft.com/en-za/access-help/guide-to-the-access-2010-user-interface-HA010341735.aspx

Which states:

Depending on your context (that is, which object you are working with and what you are doing), one or more contextual command tabs might appear next to the standard command tabs.
Can you show us the "main" ribbon XML, along with the full contextual ribbon XML? Also share how you're toggling those contextual menus?
0
 
LVL 18

Author Comment

by:Data-Man
ID: 40396690
I appreciate your comment Scott, but the link you listed has nothing to do with Custom XML created Ribbons.

My Ribbon XML is stored in UsysRibbons.

Here is the xml for the main ribbon...I cut out the XML in the middle that has all the commands.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <ribbon startFromScratch="false">
    <tabs>
      <tab id="BSItbHome" label="Home" keytip="H">
       
            All my tabs, groups and commands are here.  The XML in this area does not affect the placement of the contextual tab and has been removed..it is also proprietary.

    </tabs>
 
  </ribbon>
 
  <backstage>
    <button idMso="FileCloseDatabase" visible="false"/>
    <button idMso="SaveObjectAs" visible="false"/>
    <button idMso="FileSaveAsCurrentFileFormat" visible="false"/>
    <button idMso="FileOpen" visible="false"/>
    <button idMso="FileSave" visible="false"/>
    <tab idMso="TabInfo" visible="false"/>
    <tab idMso="TabRecent" visible="false"/>
    <tab idMso="TabNew" visible="false"/>
    <tab idMso="TabPrint" visible="true"/>
    <tab idMso="TabShare" visible="false"/>
    <tab idMso="TabHelp" visible="false"/>
    <button idMso="ApplicationOptionsDialog" visible="false"/>
    <button idMso="FileExit" visible="false"/>
  </backstage>
 
</customUI>

In the database options for the current database, I have set the application to use my custom Ribbon.   Works like a champ.  Each form has the Ribbon property set to the above Ribbon, except the few forms that require the Contextual Tab.  Those form have the Ribbon below set in their Ribbon property.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <ribbon>
    <contextualTabs>
     
      <tabSet idMso="TabSetFormReportExtensibility">
     
           The tabs and commands are here.

        </tab>

      </tabSet>
    </contextualTabs>
  </ribbon>
</customUI>


I was thinking that there is some XML that will tell the Contextual tab where to display....but haven't had any luck searching.  Although I haven't dug super deep yet....was hoping that another Access expert had some experience with this already.  I can't be the first person to create a custom Ribbon and custom contextual tab.

Thanks,
Mike
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 400 total points
ID: 40396806
The link was geared toward the way ribbons behave in Access, regardless of how they're created.

I reviewed an application where I do the same thing - create ribbons using XML, and have contextual ribbons. In my case, I'm using a class module to manage the ribbons, but essentially I store the XML in the USysRibbon table and call it as needed. Note I'm setting the RibbonName property of the Form or Report, and not using the Event Properties window.

I just include everything in that "contextual" ribbon that is needed, including the "main" ribbon code. So if my main ribbon XML is this:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" loadImage="LoadImages">
  <ribbon startFromScratch="true">
    <tabs>
      <tab id="tab0" label="Home" getVisible ="GetVisible" tag = "RibbonName:=ABB_Standard;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=" > 
        <group id="grpHome" autoScale="true" centerVertically="false" label="App Name" getVisible ="GetVisible" tag = "RibbonName:=ABB_Standard" > 
          <button id="btnAppExit" size="large" label="Exit App" screentip="Quit App" supertip=" " imageMso="AudioBookmarkRemove" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button id="btnlogout" size="large" label="Logout" screentip="Logout of App, don't exit" supertip=" " imageMso="InheritPermissions" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
        </group>
        <group id="grpSort" autoScale="false" centerVertically="false" label="Sorting and Filtering" getVisible ="GetVisible" tag = "RibbonName:=ABB_Standard" > 
          <button idMso="AdpOutputOperationsSortAscending" size="large" label="Ascending" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="AdpOutputOperationsSortDescending" size="large" label="Descending" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="SortAndFilterAdvanced" size="large" label="Advanced Filter" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="ApplyFilter" size="large" label="Apply Filter/Sort" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
        </group>
        <group id="grpEdit" autoScale="false" centerVertically="false" label="Edit" getVisible ="GetVisible" tag = "RibbonName:=ABB_Standard" > 
          <button idMso="Cut" size="large" label="Cut" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="Copy" size="large" label="Copy" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="Paste" size="large" label="Paste" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Open in new window

I'd add my contextual XML to THAT XML, and show that as my "contextual" ribbon. In my case, this worked out best, but of course there may be other ways to manage it. Downside is that if you must modify the "home" ribbon, you'd have to tweak your "contextual" ribbon XML as well. My "home" ribbon is very simple, so it's not really a big issue for me.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 18

Author Comment

by:Data-Man
ID: 40397271
Thanks Scott, I will give that a try.  It seems logical and should work.  I just thought there should be a way within a contextual Ribbon to show where it is displayed.

I will let you know,
Mike
0
 
LVL 84
ID: 40397320
I never could find a way ....
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 100 total points
ID: 40397562
Have you looked at Gunter's example for Contextual Tabs?

http://www.accessribbon.de/en/index.php?Downloads:17

mx

Contextual Tab
0
 
LVL 18

Author Closing Comment

by:Data-Man
ID: 40423108
The solution seemed strange in that you reuse the original Ribbon XML and append the Contextual Tab XML at the end.  Maintainability is harder due to multiple identical XML that will all need to be changed if one changes.  I awarded 100 points to the last post as it shows the Contextual Tab XML mixed with base Ribbon XML.

Thanks for all your help,
Mike
aka Data-Man
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question