locked
gobjRibbon.Invalidate not firing the event RRS feed

  • Question

  • Hello.

    I've got an accdb access 2007 application that has a custom ribbon and the command gobjRibbon.Invalidate is working .
    Custom ribbon works in runtime2007  with compilation and accdr extension.

    If I put the accdr on the 2013 runtime,  load event fires correct. Buttons working
    correct=(OnActionButton(control As IRibbonControl)).

    But any further change to labels does not execute 

    it's no doing any thing never getting to CallbackGetLabel(control As IRibbonControl, ByRef label).

    Calling to gobjRibbon.Invalidate or gobjRibbon.InvalidateControl does nothing.

    Any ideas?

    Leon.


    Thursday, May 24, 2018 2:26 PM

All replies

  • Hi Leon,

    How did you change label and where did you call "gobjRibbon.Invalidate"?

    Could you share us a simple file which could reproduce your issue?

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 25, 2018 2:46 AM
  • Tao Hi.

    Here is the custom ribbon definitions:
      
            <group id="grpwelcome" autoScale="false" centerVertically="false"  getLabel="CallbackGetLabel" getVisible ="GetVisible" tag = "RibbonName:=IDBERibbonCreator2010" >
              <button id="btnMeetings" size="normal"  getLabel="CallbackGetLabel" imageMso="PlanAMeeting" tag="RibbonName:=IDBERibbonCreator;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
              <button id="btnReminders" size="normal"  getLabel="CallbackGetLabel" imageMso="AddReminder" tag="RibbonName:=IDBERibbonCreator;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
            </group>
    And I've got 
    Public Sub CallbackGetLabel(control As IRibbonControl, _
                         ByRef label)
    
        Dim tasks As Integer
        Dim Meetings As Integer
        Dim RSLabel As Recordset2
        Dim d As Recordset2
            If Not IsLoaded_Form("Z_FL_02_Tizkoret_Show") Then
                Meetings = GetWorkerMeetingsCount(tasks)
            End If
            Select Case control.ID
                Case "grpwelcome"
                    If Nz(global_account_no, "") <> "" Then
                        label = " Welcome " & GetUserName(global_account_no)
                    Else
                        label = "User Name Welcome"
                    End If
                Case "btnMeetings"
                    label = "You has " & Meetings & " & Follow ups " & tasks & ""
                Case "btnReminders"
                    label = "You has " & getMSGtNo & " & New " & getMSGNoNew & " Reminders "
                Case "Cheks"
                    label = "Deferred Check Found"
                Case "btnOldFileNo"
                    Set d = db.OpenRecordset("SELECT *  FROM tpa023  [systemnop23]=""" & system_nos & """ and [wrkr]=""0000000000000000"" and line_no=87", dbOpenDynaset)
                    If d.RecordCount > 0 Then
                        If Nz(d!Desc) > "" Then
                            label = d!Desc
                        End If
                    End If
                    d.Close
                    Set d = Nothing
                Case Else
                    Set RSLabel = db.OpenRecordset("Select ControlLabel from USyRibbonLng where LngId =""en"" and ControlId =""" & control.ID & """", dbReadOnly)
                    If RSLabel.RecordCount > 0 Then
                        label = RSLabel!ControlLabel
                    End If
                    RSLabel.Close
                    Set RSLabel = Nothing
                    
            End Select
    End Sub
    On load result:

    Chang label working correct.
    Then I've got timer form that is checking for changes every 30 sec, and calling gobjRibbon.Invalidate function if changes found.
    In access 2007 All working fine. Access 2013/2016 ... 
    gobjRibbon.Invalidate does nothing it's never getting to CallbackGetLabel function or GetVisible function.
    No error produced... Just complete ignore.



    Leon

     

    Sunday, May 27, 2018 10:22 AM
  • Hi Leon,

    Could you share us how and where you called gobjRibbon.Invalidate?

    I made a test with code below, it works correctly.

    1. Ribbon

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnRibbonLoad">
      <ribbon startFromScratch="false">
        <tabs>
          <tab idMso="TabCreate" visible="false" />
          <tab id="dbCustomTab" label="A Custom Tab" visible="true">
            <group id="grpwelcome"   getLabel="CallbackGetLabel" ><button id="btnMeetings" size="normal"  getLabel="CallbackGetLabel"/>
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>

    2. CallBack

    Public isTrue As Boolean
    Public gobjRibbon As IRibbonUI
    Sub OnRibbonLoad(ribbon As IRibbonUI)
        ' Callbackname in XML File "onLoad"
    
         Set gobjRibbon = ribbon
    
    End Sub
    Public Sub CallbackGetLabel(control As IRibbonControl, _
                         ByRef label)
    
            Select Case control.ID
                Case "grpwelcome"
                    If isTrue Then
                        label = " Welcome "
                    Else
                        label = "User Name Welcome"
                    End If
                Case "btnMeetings"
                   If isTrue Then
                        label = " Welcome "
                    Else
                        label = "User Name Welcome"
                    End If
    
            End Select
    End Sub

    3. Button to call invalidate

    Private Sub Command10_Click()
    Module1.isTrue = True
    Module1.gobjRibbon.Invalidate
    End Sub

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 28, 2018 7:46 AM
  • Tao hi.

    Current update.

    In access 2016 (English version) got it working!

    Still can't make it work in Access 2013... maybe because Access 2013 I have its a Hebrew version.

    Leon

    Tuesday, May 29, 2018 8:07 AM
  • Hi Leon,

    I would suggest you make a test with Access 2013 English version.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 29, 2018 8:22 AM
  • Tao Hi,

    Still no luck with Access 2013.
    I must have it working in Hebrew environment.

    Your example On load firing.



    Any other Ideas?

    Best regards,
    Leon

    Wednesday, May 30, 2018 12:19 PM
  • For this error, I suggest you make a test with code below:

    Option Compare Database
    
    Public isTrue As Boolean
    Public gobjRibbon As IRibbonUI
    Sub OnRibbonLoad(ribbon As IRibbonUI)
        ' Callbackname in XML File "onLoad"
        
         Set gobjRibbon = ribbon
    
    End Sub
    Public Sub CallbackGetLabel(control As IRibbonControl, _
                         ByRef label)
    
            Select Case control.ID
                Case "grpwelcome"
                    If isTrue Then
                        label = " Welcome "
                    Else
                        label = "User Name Welcome"
                    End If
                Case "btnMeetings"
                   If isTrue Then
                        label = " Welcome "
                    Else
                        label = "User Name Welcome"
                    End If
    
            End Select
    End Sub
    
    


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 4, 2018 6:23 AM