Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Tool bars, Menu bars + Ribbon _ Control Not Firing Getenabled()

Posted by: mscola Feb 17 2019, 07:40 PM

I'm having the strange problem that - of all the buttons that I have on my Ribbon, one is not enabled.
The visibility of the other buttons is set by the permission stored in the DB but somehow getEnabled() is not fired for one button: mnuParkingData

I am using the ribbon creator and the getEnabled clearly states that all of the buttons have to be enabled.

Is there something wrong in the XML file (created with Ribbon Creator) or in the code?
Or why else might a control not check with GetEnabled? I put a debug.print in it to check whether it is being enabled.

I find this very strange.

Thanks four your feedback

Massimo



CODE
Sub GetEnabled(control As IRibbonControl, ByRef enabled)
    ' Callbackname in XML File "getEnabled"
    
    ' To set the property "enabled" to a Ribbon Control
    ' For further information see: http://www.accessribbon.de/en/index.php?Downloads:12
    ' Setzen der Enabled Eigenschaft eines Ribbon Controls
    ' Weitere Informationen: http://www.accessribbon.de/index.php?Downloads:12
    Debug.Print "Get enabled: " & control.id
    Select Case control.id

    
        Case "btnStartAdminCheck"
            ' Button
            ' In Tab:   tabSanagate
            ' In Group: grpStartAdmin
            If CountNumberOfChangeRequests <= 0 Then
                enabled = False
            Else
                enabled = True
            End If
            
        Case "mnuParkingData"
            enabled = True
            Debug.Print "mnuParkingData"
        
        Case Else
            enabled = True

    End Select

End Sub






CODE
        <group id="grpParkingMasterData" autoScale="true" centerVertically="true" label="Stammdaten" getVisible ="GetVisible" tag = "RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=data.png;CustomPicturePath:=C:\Users\massi\Downloads\" getImage="GetImages" >
          <button id="btnParkingCars" size="large" label="Automarken" getImage="GetImages" tag="RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=carsColor.png;CustomPicturePath:=C:\Users\massi\Downloads\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <menu id="mnuParkingData" size="large" itemSize="large" label="Berichte und Datenexport" supertip=" " getImage="GetImages" tag="RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=data.png;CustomPicturePath:=C:\Users\massi\Downloads\" getVisible="GetVisible" getEnabled="GetEnabled" >
            <menuSeparator id="sepParkingExport" title="Export" />
            <menu id="mnuParkingExport" itemSize="large" description="Exportiert Daten in Excel" label="Export" imageMso="ExportExcel" tag="RibbonName:=;inMenu:=mnuParkingData;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" getVisible="GetVisible" getEnabled="GetEnabled" >
            <button id="btnParkingExportAll" label="Parkplatzdaten exportieren" description="Exportiert" screentip="Alle Parkplätze exportieren" getImage="GetImages" tag="RibbonName:=;inMenu:=mnu_124;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=excel.png;CustomPicturePath:=C:\Users\massi\Downloads\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
            </menu>
            <!--End menu (mnuParkingExport) NOT delete this remark-->
            <menuSeparator id="sepParkingReports" title=" Berichte" />
            <menu id="mnuParkingReports" itemSize="large" description="Erstellt Berichte mit den Parkplatzdaten" label="Berichte zu den Parkplätzen" supertip=" " getImage="GetImages" tag="RibbonName:=;inMenu:=mnuParkingData;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=Acrobat.png;CustomPicturePath:=C:\Users\massi\Downloads\" getVisible="GetVisible" getEnabled="GetEnabled" >
            <button id="btnParkingReportByName" label="Nach Parkplatz sortiert" description="Erstellt einen PDF Bericht aller Parkplätze und Mitarbeitenden" supertip=" " getImage="GetImages" tag="RibbonName:=;inMenu:=mnu_124;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=Acrobat.png;CustomPicturePath:=C:\Users\massi\Downloads\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
            <button id="btnParkingReportByEmployee" label="Nach Mitarbeitende sortiert" description="Erstellt einen PDF Bericht aller Parkplätze und Mitarbeitenden" screentip="Parkplatz und Mitarbeiter" getImage="GetImages" tag="RibbonName:=;inMenu:=mnu_124;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=Acrobat.png;CustomPicturePath:=C:\Users\massi\Downloads\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
            </menu>
            <!--End menu (mnuParkingReports) NOT delete this remark-->
            <menuSeparator id="sepParkingPrint" title=" Drucken" />
            <menu id="mnuParkingPrint" itemSize="large" description="Druckt verschiedene Parkplatzdaten" label="Parkplatzdaten Drucken" supertip=" " getImage="GetImages" tag="RibbonName:=;inMenu:=mnuParkingData;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=print48.png;CustomPicturePath:=C:\Users\massi\Downloads\" getVisible="GetVisible" getEnabled="GetEnabled" >
            <button id="btnParkingPrintByParkingName" label="Nach Parkplatz sortiert" description="Druckt einen Bericht aller Parkplätze und Mitarbeitenden" supertip=" " getImage="GetImages" tag="RibbonName:=;inMenu:=mnu_124;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=print48.png;CustomPicturePath:=C:\Users\massi\Downloads\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
            <button id="btnParkingPrintByEmployee" label="Nach Mitarbeitende sortiert" description="Druckt einen Bericht aller Parkplätze und Mitarbeitenden" screentip="Parkplatz und Mitarbeitende drucken" getImage="GetImages" tag="RibbonName:=;inMenu:=mnu_124;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=print48.png;CustomPicturePath:=C:\Users\massi\Downloads\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
            </menu>
            <!--End menu (mnuParkingPrint) NOT delete this remark-->
          </menu>
          <!--End menu (mnuParkingData) NOT delete this remark-->
        </group>