Ribbon sample (new)
1.Complie this new code with MapBasic x64 compiler
2.Create your interface with the Ribbon Designer and store the [MyApp].resources.xml in the MBX folder.
click to enlarge
|
click to enlarge
code example MyApp.recources.xml
<?xml version="1.0" encoding="utf-16"?>
<Ribbon xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Tabs>
<Tab Name="MyApp" Caption="My App" Index="5" Application="MyApp" Visible="true">
<Groups>
<Group Name="MyGroup" Caption="My Group" Index="0" Application="MyApp" Visible="true">
<Controls>
<Control Name="Show" Caption="Show" Index="0" CommandId="0" Calling="mShow" Cursor="0" DrawMode="34" Type="Button" IsToggle="false" IsSelected="false" Enabled="true" Visible="true" ModifierKeys="false" IsLarge="true" SmallIconName="images/mapping/addbasemap_16x16.png" LargeIconName="images/mapping/addbasemap_32x32.png" IconDLL="MapInfo.StyleResources" ToolTipDescription="Show" ToolTipText="Shows selected objects in the cuurent map window" ToolTipDisabledText="A selection is required" Application="MyApp" Requires="None" HelpId="0" Orientation="Vertical" RequiresSelection="True" RequiresReadOnly="None" RequiresEditable="None" RequiresMappable="True" RequiresFrontWindow="None" />
<Control Name="Theme" Caption="Theme" Index="1" CommandId="0" Calling="mTheme" Cursor="0" DrawMode="34" Type="Button" IsToggle="false" IsSelected="false" Enabled="true" Visible="true" ModifierKeys="false" IsLarge="true" SmallIconName="images/mapping/addtheme_16x16.png" LargeIconName="images/mapping/addtheme_32x32.png" IconDLL="MapInfo.StyleResources" Application="MyApp" Requires="None" HelpId="0" Orientation="Vertical" RequiresSelection="None" RequiresReadOnly="None" RequiresEditable="None" RequiresMappable="None" RequiresFrontWindow="None" />
</Controls>
</Group>
</Groups>
</Tab>
</Tabs>
<VersionRibbonDesigner>1.0.0.0</VersionRibbonDesigner>
<VersionMapInfo>12.5.0.311</VersionMapInfo>
<Index>0</Index>
<Type>NotSet</Type>
</Ribbon>
|
|
3.Start MapInfo Pro 64-Bit
4.Start your application MBX
declare sub Main
declare sub mShow
declare sub mTheme
Declare Sub EndHandler
Declare Method New_RibbonSDK Class "GeoAS.RibbonSDK.Addin" Lib "GeoAS.RibbonSDK.dll" Alias Ctor_CreateInstance() as This
Declare Method Initialize Class "GeoAS.RibbonSDK.Addin" Lib "GeoAS.RibbonSDK.dll" Alias Initialize(ByVal p1 as This, ByVal p2 as refptr, ByVal p3 as String)
Declare Method Unload Class "GeoAS.RibbonSDK.Addin" Lib "GeoAS.RibbonSDK.dll" Alias Unload(ByVal p1 as This)
Declare Function AddIn_Name() As String
Global myAddIn as This
'******************************
Sub EndHandler
call Unload(myAddIn)
End Sub
'******************************
Function AddIn_Name() As String
AddIn_Name = "MyApp"
End Function
'********************************
sub Main
'Create Menu "MyApp" as
' "Show" calling mShow,
' "Theme" calling mTheme
'Alter Menu bar add "MyApp"
myAddIn = New_RibbonSDK()
call Initialize(myAddIn, SYSTEMINFO(SYS_INFO_IMAPINFOAPPLICATION), ApplicationName$() )
end sub
'********************************
sub mShow
note "Show"
end sub
'********************************
sub mTheme
note "Theme"
end sub
'********************************