UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Ribbon Won't Invalidate, Access 2016    
 
   
awjensen
post Jun 28 2018, 03:45 AM
Post#1



Posts: 12
Joined: 3-May 16



I have two custom ribbons: "Museum" and "PrintReport." I want to use the PrintReport ribbon for (you guessed it) all my reports. All of my forms use the Museum ribbon and I can make changes to that ribbon (invalidate and invalidatecontrol) easily. However, once a report is opened and the PrintReport ribbon is displayed, I can no longer make changes to the Museum ribbon using gobjRibbon.invalidate.


I understand that there is a way to reference the ribbon I am trying to invalidate but I haven't found a detailed explanation of how to do it. Can anyone help?
Go to the top of the page
 
JonSmith
post Jun 28 2018, 04:06 AM
Post#2


UtterAccess VIP
Posts: 4,051
Joined: 19-October 10



Yes, I can help. can we see your ribbon XML as that will help me from guessing some stuff.

Basically what is possibly happening is that your two ribbons both set a reference to "gobjRibbon" and that variable can only hold one of them.
You can easily fix this by adding a second variable for the second ribbon and changing the load event so they use the different variables.

You can go a step further and store all the ribbon variables in a collection to make it more flexible too. I think this would involve having the ribbon object as a class rather than gobjRibbon but it would be pretty easy to set up and use.

So yeah, share your ribbon XML and your onLoad callback(s)
Go to the top of the page
 
awjensen
post Jun 29 2018, 01:19 PM
Post#3



Posts: 12
Joined: 3-May 16



Thanks JonSmith for your positive reply. I have found a way around the issue. Modified the following line in the XML for the PrintReport ribbon:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" loadImage="LoadImages">
as follows:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">

Caution: I am using the IDBE Ribbon Creator 2016 and that program will always overwrite any customizations made to this line.

My fix allows me to dynamically customise the main ribbon but not the PrintReport ribbon. Others have run into this issue but I can't find a clear cut explanation of how to deal with multiple ribbons.
Go to the top of the page
 
JonSmith
post Jun 29 2018, 01:26 PM
Post#4


UtterAccess VIP
Posts: 4,051
Joined: 19-October 10



QUOTE
My fix allows me to dynamically customise the main ribbon but not the PrintReport ribbon. Others have run into this issue but I can't find a clear cut explanation of how to deal with multiple ribbons.


Well yeah, thats what I'm offering, an explanation and solution. The line with the onLoad callback was what I was looking for and your onLoad Callback would be the other part of the puzzle. Its really easy to handle multiple ribbons and I can clearly explain the problem but seeing the code will make it much much easier to explain.
This post has been edited by JonSmith: Jun 29 2018, 01:27 PM
Go to the top of the page
 
awjensen
post Jun 29 2018, 02:08 PM
Post#5



Posts: 12
Joined: 3-May 16



Hope the attached is everything you need Here is the OnRibbonLoad sub.
CODE
Sub OnRibbonLoad(ribbon As IRibbonUI)
    ' Callbackname in XML File "onLoad"

    Set gobjRibbon = ribbon
    
    If IsLoaded("frmArtifacts") Then
        fArtifactTab (True)
    Else
        fArtifactTab (False)
    End If
    
    
End Sub


Attached File(s)
Attached File  XML_files.zip ( 2.01K )Number of downloads: 9
 
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    21st August 2019 - 03:09 AM