Disable button on the ribbon

10 views
Skip to first unread message

Louise Kavanagh

unread,
Mar 30, 2022, 5:49:44 AM3/30/22
to mapi...@googlegroups.com

Hello,

 

I have added a push button to the ribbon but initially I would like it disabled does anyone know how this can be done?  Here is the code I have for adding the button:

 

Dim ClearFilterControlID As Integer

  nCtrlIdx = RBNGroupAddButton ("Clear", "Clear WF Filter", "", sTabName, sGroupName)

      If nCtrlIdx > 0 Then

            

      Call RBNControlSetToolTipIdx(nCtrlIdx, "Windfarms",   "Clear WF Filter", "")

         'Set the button icon

         Call RBNControlSetIconsIdx(nCtrlIdx, CONTROL_SIZE_Large, "", user_programs_path + "Images\Bitmap50b.bmp")

         'Set Custom MapBasic Handle to the button

         Call RBNControlSetCustomMBXHandlerIdx(nCtrlIdx, "Clear_WF_filter")

 

         'Getting its Control ID for later use

         If ClearFilterControlID = 0 Then

            ClearFilterControlID = RBNControlGetControlIDIdx(nCtrlIdx)

         End If

      End if

 

I would also like to know how to enable it within the code once a different button has been used.

 

Any ideas much appreciated.

 

Thanks and best wishes,

Louise

 

Louise Kavanagh

Managing Director

 

 

  louise....@apogeedata.co.uk | +44 (0)7736 438822 | Subscribe

 

 

 

image001.jpg
image002.jpg

Peter Horsbøll Møller

unread,
Mar 30, 2022, 6:02:56 AM3/30/22
to mapi...@googlegroups.com

Hi Louise,

 

I can see you are using the RibbonLib.

 

You can use the procedure RBNGroupEnableControls() to do this:

Sub RBNGroupEnableControls(  ByVal sTabName As String       'If "", the TAB is ignored in the search

                           , ByVal sGroupName As String     'If "", the GROUP is ignored in the search

                           , ByVal sControlName As String

                           , ByVal bEnabled As Logical)

 

You can be very specific and only disable it on a specific ab/group or let the RibbonLib search through all your tabs by entered an empty string for your tab and group name.

Note that only the controls added by this application will get enabled as it’s using an internal array of controls to search through

 

Here’s how the procedure can be used, if you have it on multiple tabs/multiple groups:

     Call RBNGroupEnableControls("", "", "cmdDDAnalyzerO2D", FALSE)

 

The last parameter tells the procedure to enable (TRUE) or disable (FALSE) the control

The parameter sControlName is the internal name of the control, not the caption.

 

Peter Horsbøll Møller

www.precisely.com | Knowledge Communities | #MapInfoMonday

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Louise Kavanagh
Sent: 30. marts 2022 11:49
To: mapi...@googlegroups.com
Subject: [MI-L] Disable button on the ribbon

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/017701d8441b%2472b993c0%24582cbb40%24%40apogeedata.co.uk.

Louise Kavanagh

unread,
Mar 30, 2022, 6:54:55 AM3/30/22
to mapi...@googlegroups.com

Thanks Peter – I’ll give it a go.

 

Best wishes,

image001.jpg
image002.jpg
Reply all
Reply to author
Forward
0 new messages