Adding Tool Button to Ribbon Interface

123 views
Skip to first unread message

Louise Kavanagh

unread,
Oct 15, 2019, 1:11:59 AM10/15/19
to mapi...@googlegroups.com

Hello,

 

I am customizing the ribbon in v17.  I have successfully added a new tab, new groups to that tab and new buttons or split buttons to the group.  However, I need to add a “Tool” button.

 

What is the equivalent of “Add ToolButton” for the ribbon?

 

Many thanks,

Louise

 

 

 

Louise Kavanagh

Managing Director

 

apogeelogo-rgb-halfinch

 

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

 

 

 

image005.jpg
image006.jpg

Peter Horsbøll Møller

unread,
Oct 15, 2019, 4:10:42 PM10/15/19
to mapi...@googlegroups.com

Hi Louise

 

Sorry that I haven’t responded earlier.

 

Here is an example where I’m adding a ToolButton to a group on a TabGroup:

 

nCtrlIdx = RBNGroupAddControl("DTPolylineAddStartNode", "Add Start Node", "", ControlType_ToolButton, sTabName, sGroupName)

If nCtrlIdx > 0 Then

   'Create & Set the button tooltip

   Call RBNControlSetToolTipIdx(nCtrlIdx, PRGIGetApplicationName(), "Add new start node to selected polyline where clicked.", "Make sure you have selected a polyline from the editable layer.")

   'Set the button icon

   Call RBNControlSetIconsIdx(nCtrlIdx, CONTROL_SIZE_LARGE, "", ApplicationDirectory$() & "Images\PolylineAddStartNode_32.png")

   'Set DrawMode

   Call RBNControlSetDrawModeIdx(nCtrlIdx, DM_CUSTOM_POINT)

   'Set Cursor

   Call RBNControlSetMICursorIdx(nCtrlIdx, MI_CURSOR_CROSSHAIR, "")

   'Set Custom MapBasic Handle to the button

   Call RBNControlSetCustomMBXHandlerIdx(nCtrlIdx, "DTPolylineAddStartNode")

End If

 

I have highlighted the major differences between adding a (Push)Button and a ToolButton in red;

-          ControlType is ControlType_ToolButton

-          You need to set the drawmode

-          You need to set the cursor

 

Hope this helps

 

Peter Horsbøll Møller

Pitney Bowes

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Louise Kavanagh
Sent: 14. oktober 2019 15:40
To: mapi...@googlegroups.com
Subject: [MI-L] Adding Tool Button to Ribbon Interface

 

CAUTION: THIS EMAIL IS FROM AN EXTERNAL SOURCE. Internet links, office documents or other attachments may contain viruses. Do not click on a link, open or enable any file unless you trust the sender.

--
--
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/009901d58294%24e5428410%24afc78c30%24%40apogeedata.co.uk.

Louise Kavanagh

unread,
Oct 16, 2019, 8:14:09 AM10/16/19
to mapi...@googlegroups.com

Hi Peter,

 

No problem at all.

 

Thank you for this it was exactly what I have been looking for.

 

I also need to add a “Toggle” button at some point.  For example, a button that when clicked will turn a layer display on/off.  Does that make sense?  Can you send me similar for this type of control?

 

Many thanks,

Louise

image001.jpg
image002.jpg

Peter Horsbøll Møller

unread,
Oct 22, 2019, 8:16:54 AM10/22/19
to mapi...@googlegroups.com

 

Peter Horsbøll Møller

Pitney Bowes

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Louise Kavanagh
Sent: 16. oktober 2019 14:14
To: mapi...@googlegroups.com
Subject: RE: [MI-L] Adding Tool Button to Ribbon Interface

 

CAUTION: THIS EMAIL IS FROM AN EXTERNAL SOURCE. Internet links, office documents or other attachments may contain viruses. Do not click on a link, open or enable any file unless you trust the sender.

Ule TMUS

unread,
Jul 23, 2022, 11:26:56 AM7/23/22
to mapi...@googlegroups.com
I'm getting error "DM_Custom_POIT" nod defined
trying to use ribbon lib, what I'm missing?


snapshot of my code (user press the buttom then click in the map )



'**Adding a Group to the new SplitButton
nCtrlIdx = RBNSplitButtonAddGroup("ViewSatGroup", "", sTabName, sGroupName, "butViewSat")

If nCtrlIdx > 0 Then

'**Adding a Control to the Group on the SplitButton
nCtrlIdx = RBNSplitButtonGroupAddControl("butViewSat", "Satellite View", "", ControlType_ToolButton, sTabName, sGroupName, "butViewSat", "ViewSatGroup")
If nCtrlIdx > 0 Then
Dim SplitButton1 as This
                SplitButton1 = nCtrlIdx
'Create & Set the button tooltip 1st buttom
Call RBNControlSetToolTipIdx(nCtrlIdx,"ViewSat", "Satellite Level View", "")
'Set the button icon
Call RBNControlSetIconsIdx(nCtrlIdx, CONTROL_SIZE_LARGE, "", PATH_IMAGES & "EarthView_32.png")


'Set DrawMode
Call RBNControlSetDrawModeIdx(nCtrlIdx, DM_CUSTOM_POINT)
'Set Cursor
Call RBNControlSetMICursorIdx(nCtrlIdx, MI_CURSOR_CROSSHAIR, "")

'Set Custom MapBasic Handle to the button, call funtion that do the job
Call RBNControlSetCustomMBXHandlerIdx(nCtrlIdx, "SatelliteView")

--

Peter Horsbøll Møller

unread,
Jul 24, 2022, 4:09:46 AM7/24/22
to mapi...@googlegroups.com
Hi

Have you included the file “icons.def” in your source file?

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

 


Den 23. jul. 2022 kl. 17.27 skrev Ule TMUS <uletm...@gmail.com>:



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


Reply all
Reply to author
Forward
0 new messages