OpenTable
Opens the browser window with the table containing the selected object.
This example shows:
  • the use of icons in .Net assemblies
  • the calling of a MapBasic-routine implemented in the mbx-file
  • the implementation of the About-window, the tooltip, the help and the icon in the Toolmanager
  • the use of a help-Id and the implementaion of a help-routine in the mbx-file
Include "MapBasic.def"

Declare Sub Main
Declare Sub OpenTable
Declare Sub ShowHelp(ByVal helpId as String)


'Ribbon SDK *************
	Declare Sub EndHandler
	Declare Method New_RibbonSDK Class "GeoAS.RibbonSDK.Addin" Lib "GeoAS.RibbonSDK.dll" Alias Ctor_CreateInstance() as This
	Declare Method AlterControl Class "GeoAS.RibbonSDK.Addin" Lib "GeoAS.RibbonSDK.dll" Alias AlterControl(byval xml as string)
	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 
	Declare Function AddIn_Description() As String 
	Declare Function AddIn_Version() As String 
	Declare Function AddIn_ImageUri() As String
	Declare Sub AddIn_About
	Declare Sub AddIn_Help

	Global myAddIn as This

'************************************************************************************
Sub Main
	myAddIn = New_RibbonSDK()
	call Initialize(myAddIn, SYSTEMINFO(SYS_INFO_IMAPINFOAPPLICATION), ApplicationName$() )
End Sub
'------------------------------------------------------------------------------------
Sub EndHandler
	call Unload(myAddIn)
End Sub

'************************************************************************************
Function AddIn_Name() As String
	AddIn_Name = "OpenTableBySelection"
End Function
'------------------------------------------------------------------------------------
Function AddIn_Description() As String
	AddIn_Description = "Example to open the table containing the selected object in a browserwindow"
End Function
'------------------------------------------------------------------------------------
'Tooltip des Info-Buttons
'Wird nur angezeigt, wenn auch AddIn_About definiert
Function AddIn_Version() As String
	AddIn_Version = "Version 2.0"
End Function
'------------------------------------------------------------------------------------
Function AddIn_ImageUri() As String
	AddIn_ImageUri = "pack://application:,,,/MapInfo.StyleResources;component/images/application/opendatatable_16x16.png"
End Function
'------------------------------------------------------------------------------------
'Aktion des Info-Buttons
Sub AddIn_About
    Dim app_dir As String
    app_dir = ApplicationDirectory$( )
	Dim helpcmd as String
	helpcmd = "notepad.exe  " & app_dir & "\help.txt"
	Run Program helpcmd 
End Sub
'------------------------------------------------------------------------------------
Sub AddIn_Help
	Note "Ribbon Sample Help"
End Sub
'************************************************************************************
Sub OpenTable
	dim tab as String
    tab = SelectionInfo( SEL_INFO_TABLENAME ) 
	browse * from tab
End Sub
'------------------------------------------------------------------------------------
Sub ShowHelp(ByVal helpId as String)
	note helpId
End Sub