Ok. Thanks
COMUNIDAD. AUT. REG MURCIA
Original Message:
Sent: 02-28-2024 02:50
From: Peter Møller
Subject: How RBNMapMTBAddControl works MAPBASIC
Hi
Icons.def holds the various DrawModes:
define DM_CUSTOM_CIRCLE 30define DM_CUSTOM_ELLIPSE 31define DM_CUSTOM_RECT 32define DM_CUSTOM_LINE 33define DM_CUSTOM_POINT 34define DM_CUSTOM_POLYGON 35define DM_CUSTOM_POLYLINE 36
Most of them return coordinates that you access via CommandInfo
. DM_CUSTOM_POLYGON
and DM_CUSTOM_POLYLINE
return spatial objects which you also access through CommandInfo
.
You can also assign different cursors to your tools if you want. They are also defined in Icons.def. These are just some of them:
define MI_CURSOR_ARROW 0define MI_CURSOR_IBEAM 1define MI_CURSOR_CROSS 2define MI_CURSOR_PLUS 3define MI_CURSOR_WAIT 4define MI_CURSOR_FINGER_LEFT 128define MI_CURSOR_ZOOM_IN 129define MI_CURSOR_ZOOM_OUT 130define MI_CURSOR_DRAG_OBJ 131define MI_CURSOR_GRABBER 132define MI_CURSOR_CHANGE_WIDTH 133define MI_CURSOR_FINGER_UP 134define MI_CURSOR_IBEAM_CROSS 135define MI_CURSOR_HELP 137define MI_CURSOR_CROSSHAIR 138define MI_CURSOR_NODROP 139define MI_CURSOR_DRAG_LAYER 140define MI_CURSOR_DRAG_LAYERS 141define MI_CURSOR_BEGIN_DRAGNDROP 142define MI_CURSOR_DOING_DRAGNDROP 143define MI_CURSOR_DRAGNDROP_COPY 144define MI_CURSOR_DRAGNDROP_LINK 145define MI_CURSOR_DRAGNDROP_MOVE 146define MI_CURSOR_DRAGNDROP_NONE 147define MI_CURSOR_MOUSESCROLL_N 148define MI_CURSOR_MOUSESCROLL_NE 149define MI_CURSOR_MOUSESCROLL_E 150define MI_CURSOR_MOUSESCROLL_SE 151define MI_CURSOR_MOUSESCROLL_S 152define MI_CURSOR_MOUSESCROLL_SW 153define MI_CURSOR_MOUSESCROLL_W 154define MI_CURSOR_MOUSESCROLL_NW 155define MI_CURSOR_MOUSESCROLL_CTR 156define MI_CURSOR_SIZE_NESW 157define MI_CURSOR_SIZE_NS 158define MI_CURSOR_SIZE_NWSE 159 define MI_CURSOR_SIZE_WE 160define MI_CURSOR_MOVE 161define MI_CURSOR_ACT_HAND 162define MI_CURSOR_ACT_HAND2 163define MI_CURSOR_LRG_CROSSHAIR 164define MI_CURSOR_TINY_CROSSHAIR 165define MI_CURSOR_ADORNMENT 166define MI_CURSOR_ADORNMENT_MOVE 167
Similarly, all the icons that you see in MapInfo Pro can be used in your tool. They are defined in RibbonControls.def. Again, this is just a small portion:
Define MI_IMG_APP_CLOSEALL_16 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/closeAll_16x16.png"Define MI_IMG_APP_CLOSEALL_32 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/closeAll_32x32.png"Define MI_IMG_APP_CLOSEDBMS_16 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/closeDbms_16x16.png"Define MI_IMG_APP_CLOSEDBMS_32 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/closeDbms_32x32.png"Define MI_IMG_APP_IMPORT_16 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/import_16x16.png"Define MI_IMG_APP_IMPORT_32 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/import_32x32.png"Define MI_IMG_APP_OPENDBMS_16 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/openDbms_16x16.png"Define MI_IMG_APP_OPENDBMS_32 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/openDbms_32x32.png"Define MI_IMG_APP_OPENUNIVERSAL_16 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/openUniversal_16x16.png"Define MI_IMG_APP_OPENUNIVERSAL_32 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/openUniversal_32x32.png"Define MI_IMG_APP_OPENWFS_16 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/openWfs_16x16.png"Define MI_IMG_APP_OPENWFS_32 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/openWfs_32x32.png"Define MI_IMG_APP_OPENWMS_16 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/openWms_16x16.png"Define MI_IMG_APP_OPENWMS_32 "pack://application:,,,/MapInfo.StyleResources;component/Images/Application/openWms_32x32.png"
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 02-27-2024 03:18
From: Mayca González Pérez
Subject: How RBNMapMTBAddControl works MAPBASIC
Perfect, now it works.
Is there a manual that indicates all the functions that can be defined in mapinfo?
For example DM_CUSTOM_POINT draws a point, now I want to know the function to draw a rectangle or move function....?
And for the icons ?
Thanks
------------------------------
Mayca González Pérez
COMUNIDAD. AUT. REG MURCIA
Original Message:
Sent: 02-27-2024 02:45
From: Peter Møller
Subject: How RBNMapMTBAddControl works MAPBASIC
Hi
Yeah, you'll need to create a custom tool to achieve this.
This requires 2 changes to your code above.
1. You'll have to specify the button to be a ToolButton
and set a DrawMode
for it too. Note that I have switched to other methods (SetRbnToolBtn...
) now that I'm creating a ToolButton
and not a PushButton
.
btnPunto = MICtrlCollAddStrStrInt(EielControlCol2, "Visualizar", "Ver", ControlType_ToolButton) 'ControlTypes are defined in Enums.defCall SetRbnToolBtnCtrlDrawMode(btnPunto, DM_CUSTOM_POINT) 'DrawModes are define din Icons.defCall SetRbnToolBtnCtrlCallingHandler(btnPunto, "Punto")Call SetRbnToolBtnCtrlSmallIcon(btnPunto, New_Uri("pack://application:,,,/MapInfo.StyleResources;component/Images/Layout/symbol_32x32.png", 0))
2. You'll have to get the coordinate and create the point yourself in the procedure called by the tool.
Sub PuntoDim fX, fY As FloatOnError GoTo etiquetaError If WindowInfo(FrontWindow(),WIN_INFO_TYPE)<>WIN_MAPPER Then Note "Esta herramienta solo puede ser utilizada en una ventana de mapa." Exit Sub End if '**Let's set the coordsys to match the map '**and then grab the coordinates where the user clicked Set CoordSys Window FrontWindow() fX = CommandInfo(CMD_INFO_X) fY = CommandInfo(CMD_INFO_Y) Dim intLayer as Integer intLayer=MapperInfo(FrontWindow(),MAPPER_INFO_EDIT_LAYER) If intLayer=-1 then Note "Esta herramienta solo puede ser utilizada sobre una capa editable." Exit sub End If Dim strLayer as String strLayer=LayerInfo(FrontWindow(),intLayer,LAYER_INFO_NAME) print "dddd"+fX If gblDUPLICAR=True Then Dim objCustom As Object Create Point Into Variable objCustom (fX,fY) Call Duplicate(strLayer) Call Replicate(strLayer,objCustom) Close Table OBJAUX Run Menu Command ID 10 Else Call Mostrar Run Menu Command M_TOOLS_SELECTOR End If Exit SubetiquetaError: Note "ERROR : " + Chr$(13) & Chr$(10) + Error$()End Sub
I didn't change much here. I set the coordsys and store the coordinates where the user clicked into two variables.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 02-26-2024 08:52
From: Mayca González Pérez
Subject: How RBNMapMTBAddControl works MAPBASIC
Ok I'll do tests
Another question.
I have this button that I want to insert a point into the map and launch the POINT function after drawing the point. How do I do it? The thing is that with this code the function is launched before the point is drawn
btnPunto = MICtrlCollAddStrStrInt(EielControlCol2, "Visualizar", "Ver", 1)Call SetRbnBtnCtrlCmdID(btnPunto, M_TOOLS_POINT)Call SetRbnBtnCtrlCallingHandler(btnPunto, "Punto")Call SetRbnBtnCtrlSmallIcon(btnPunto, New_Uri("pack://application:,,,/MapInfo.StyleResources;component/Images/Layout/symbol_32x32.png", 0))Sub PuntoOnError GoTo etiquetaError If WindowInfo(FrontWindow(),WIN_INFO_TYPE)<>WIN_MAPPER Then Note "Esta herramienta solo puede ser utilizada en una ventana de mapa." Exit Sub End if Dim intLayer as Integer intLayer=MapperInfo(FrontWindow(),MAPPER_INFO_EDIT_LAYER) If intLayer=-1 then Note "Esta herramienta solo puede ser utilizada sobre una capa editable." Exit sub End If Dim strLayer as String strLayer=LayerInfo(FrontWindow(),intLayer,LAYER_INFO_NAME) print "dddd"+CommandInfo(CMD_INFO_X) If gblDUPLICAR=True Then Dim objCustom As Object Create Point Into Variable objCustom (CommandInfo(CMD_INFO_X),CommandInfo(CMD_INFO_Y)) Call Duplicate(strLayer) Call Replicate(strLayer,objCustom) Close Table OBJAUX Run Menu Command ID 10 Else Call Mostrar Run Menu Command M_TOOLS_SELECTOR End IfExit SubetiquetaError: Note "ERROR : " + Chr$(13) & Chr$(10) + Error$()End Sub
------------------------------
Mayca González Pérez
COMUNIDAD. AUT. REG MURCIA
Original Message:
Sent: 02-22-2024 04:02
From: Peter Møller
Subject: How RBNMapMTBAddControl works MAPBASIC
Hi
I have used this to add two buttons to the Map Mini Toolbar that didn't exist back in pre-version 17.0:
'First add a stackpanel to the Map Mini ToolbarnCtrlIdx = RBNMapMTBInsertStackPanelAfter("stpWindowHelper", "Info", "MapTools2")If nCtrlIdx > 0 Then Call RBNControlSetLeftMarginIdx(nCtrlIdx, 0) 'Then add the controls that stackpanel - first control nCtrlIdx = RBNMapMTBStackPanelAddControl("stptbtInfoTool", "", "", ControlType_ToolButton, "stpWindowHelper") If nCtrlIdx > 0 Then Call RBNControlSetToolTipIdx(nCtrlIdx, PRGIGetApplicationName(), GetResItemStr("STR_TTIP_INFO_TOOL"), "") Call RBNControlSetIconsIdx(nCtrlIdx, CONTROL_SIZE_SMALL, MI_IMG_MAP_INFOTOOL_16, "") Call RBNControlSetCmdIDIdx(nCtrlIdx, 1707) End If 'Then add the controls to that stackpanel - second control nCtrlIdx = RBNMapMTBStackPanelAddControl("stptbtRuler", "", "", ControlType_ToolButton, "stpWindowHelper") If nCtrlIdx > 0 Then Call RBNControlSetToolTipIdx(nCtrlIdx, PRGIGetApplicationName(), GetResItemStr("STR_TTIP_RULER_TOOL"), "") Call RBNControlSetIconsIdx(nCtrlIdx, CONTROL_SIZE_SMALL, MI_IMG_WIN_RULER_16, "") Call RBNControlSetCmdIDIdx(nCtrlIdx, 1710) End IfEnd If
I hope this helps
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 02-20-2024 03:30
From: Mayca González Pérez
Subject: How RBNMapMTBAddControl works MAPBASIC
Hi.
I want to customize the mini map toolbar with Mapbasic.
Can you show me an example?
I have seen there that there is a RBNMapMTBAddControl function but I don't know how to use it.
Thanks
------------------------------
Mayca González Pérez
COMUNIDAD. AUT. REG MURCIA
------------------------------