MapInfo Pro

 View Only
  • 1.  How to integrate MapInfo Application with custom made .Net Application?

    Posted 11-06-2017 09:36

    I want to check whether we can integrate custom .NET application with MapInfo Professional. I would like to pass a value from custom .NET application to the MapInfo and when we click a button on Custom .NET Application, MapInfo should open within the custom .NET application with few tables opened in the workspace. Can this be possible? Can we make such integrations with MapInfo?



  • 2.  RE: How to integrate MapInfo Application with custom made .Net Application?

    Posted 11-07-2017 00:22

    I am an underdog in .NET and trying to integrate MapInfo application inside the custom .NET application. I am looking for some help and references to make this happen.

    I am able to get MapInfo into a form using onform load and to close MapInfo onform unload by taking this code as the reference.

    https://nathanw.net/2010/02/19/embedding-the-whole-mapinfo-application-in-a-net-form/

    I want to restrict the MapInfo to display only a few commands when it gets open. The user should not be able to use the quick access bar or any other commands apart from what I choose to be visible.

    But the challenge is, how do I hide all unnecessary commands or tabs ( Home, Spatial,..e.t.c) and load only what I want when we open the MapInfo?

    The only approach I have is to hide all the unnecessary tabs and commands and create a plugin (.MBX) which opens one tab with all the necessary commands (open tab, open WMS,e.t.c).

    It would very much helpful for me if someone can guide me to crack this.

    Thanks in advance! Cheers :)



  • 3.  RE: How to integrate MapInfo Application with custom made .Net Application?

    Employee
    Posted 11-07-2017 09:34

    Hi,

    You are kind of on the right track but you don't have to create a MBX to modify the ribbon. You can do that via .NET as well.

    I would use the method you are proposing. Hide the tabs you don't want the user to access, potential this could be all and then basically add a new tab where you add your control.

    Another option could be to hide all the tabs and create a couple of buttons on your :NET form to access the specific MapInfo Pro elements you want the user to have access to.

    I assume that you already have installed MapBasic. In the Samples folder, you can find some samples that show how to work with the ribbon from .NET.

    I would suggest that you take a look at these samples:

    • Samples\RIBBONINTERFACE\DotNet\ProSampleAddIn
    • Samples\RIBBONINTERFACE\DotNet\RibbonCustomization

     



  • 4.  RE: How to integrate MapInfo Application with custom made .Net Application?

    Posted 11-07-2017 12:23

    Thanks peter, I am using the sample Ribbon example code that you have posted in Github.

    https://github.com/PeterHorsbollMoller/mbRibbonExample

    and combining the following code that @David Wilson? has shared in another discussion

    " If NOT RBNTabExists(sTab) Then

      '**Adding the TAB named TabTools with the caption of TOOLS

      '**nCtrlIdx is a reference to the element in the RibbonLib

      nCtrlIdx = RBNAddTab(sTab, sCaption, sTip)

      If nCtrlIdx <> 0 Then

       iTabs = Ubound(gsMenuTabs)+1

       redim gsMenuTabs(iTabs)

       gsMenuTabs(iTabs) = sTab   

        Exit Function

      End If

     end if

     

    For the turning on/off of a Tab:

    Call RBNTabSetVisibility(sTabName,lShow) " Thanks both for your valuable time . cheers!



  • 5.  RE: How to integrate MapInfo Application with custom made .Net Application?

    Posted 11-08-2017 10:28

    I have commented the same in one of the relative questions in the forum!

    Hi All,

    I am able to hide all the tabs from Ribbon and display my custom tab whenever I open the MapInfo application standalone and also from the Sample .NET form button (Onform Load and Onform Unload) which calls MBX file which will embed the MapInfo.

    Thanks to @Peter Horsbøll Møller? & @David Wilson?  suggestions and their example code.

    Usually, Whenever we double click on the top ribbon area for any windows application, Application gets maximized or minimized. when I do the same in Mapinfo standalone with the Custom MBX it is working as usual ( Hiding Quick access toolbar along with the other Tabs in the ribbon).

    But, When I click on the MapInfo Application from the .NET form, I can see the quick access toolbar showing up.It is resizing the MIPro window Onform when we double click on left upper corner. It makes MapInfo window smaller and that makes quick access toolbar visible. you can see the same in below images.

    Before double-clicking on the ribbon

    Before double click

     

    After Double-clicking on the ribbon

    after double click

     

    This is the .NET form code

    private void button1_Click_1(object sender, EventArgs e)

           {

     string handle = mapinfo.Eval("SystemInfo(9)");

     // Convert the handle to an IntPtr type.

     IntPtr oldhandle = new IntPtr(Convert.ToInt32(handle));

     //Set the parent of MapInfo to a picture box on the form.

     SetParent(oldhandle, this.pictureBox1.Handle);

     //Get current window style of MapInfo window

     int style = GetWindowLong(oldhandle, GWL_STYLE);

    //Take current window style and remove WS_CAPTION(title bar) from it

    SetWindowLong(oldhandle, GWL_STYLE, (style & ~WS_CAPTION));            

    //Maximize MapInfo so that it fits into our control.

    mapinfo.Do("Set Window 1011 Max");

    String path = @Environment.CurrentDirectory;

    String command = "Run Application \""+path+"\\..\\..\\MapProcess\\HideRibbon.MBX\" mode current";

    mapinfo.Do(command);

    }

    I really want to know

    1. How do we hide the quick access toolbar from the .NET form?
    2. Should I call any method from any definition file? I used IMapInfoPro.def and MapBasic.def files in the entire process. is there any specific method we should call in Mapbasic code?
    3. How to disable that Maximize or minimise MapInfo window facility when we are accessing it from .NET form using Onform load and Onform Unload?

     

    In the broader perspective, I am trying to replace MapXtream and SSA with MapInfo. Will there be any API which we can embed the MapInfo with above functionality? (Pls mind my ignorance :D)

    Expecting some suggestions from the knowledgeable people. Cheers :)



  • 6.  RE: How to integrate MapInfo Application with custom made .Net Application?

    Employee
    Posted 11-09-2017 00:19

    Hi,

    From what I understood, you want to integrate MapInfo Application Components into your custom .Net Application.

    You can surely do that using the integrated mapping and we provide some samples with MapBasic installation which will guide you. With integrated mapping you can create your own custom .Net Application with its own UI and than integrate MapInfoPro components into it like Map, Browser etc.

    I would suggest looking at below samples in MapBasic installation for more help.

    • Samples\DOTNET\IntegratedMappingWpf
    • Samples\DOTNET\IntegratedMappingWinForms
    • Samples\DOTNET\IntegratedMappingWinFormsVB

     

    Thanks

    Anshul



  • 7.  RE: How to integrate MapInfo Application with custom made .Net Application?

    Posted 11-10-2017 01:38

    Hi @Anshul Goel? , your references helped me to avoid Quick access toolbar hiding. Thanks for that.

    But, If I say the user should not know that they are installing MapInfo to use the example application that you have suggested. How do we manage that?

    And also can we pass a value form .NET web application to the sample integrated MapInfo application. So that whenever the user clicks on a button in .NET web application, it should open the custom MapInfo application with a query results opened in the workspace? Is it a possible use case?

    This is just some out of the quriocity question, Can we open custom MapInfo application in a web application popup with the same process which I have stated above?

    Thanks in advance, Cheers :)



  • 8.  RE: How to integrate MapInfo Application with custom made .Net Application?

    Employee
    Posted 11-10-2017 02:42

    Hi @Krishna Bejawada? 

    To use integrated mapping application you have to install MapInfoPro on the machine. However if you want that user of your custom application should not know they are installing MapInfoPro, than you can silently install MapInfoPro from within your custom application installer. (Check the MapInfoPro installation guide to see how to install MapInfo Pro silently from within another installer).

     

    For your second question: You can surely pass a value from .Net web application to the sample integrated MapInfo application using some inter-process communication (like putting the value into some file and check for that file on system or opening up a rest endpoint within the integrated mapping application).

    In integrated mapping application you can use any of the C# constructs with MapInfo objects to design the application as per your needs.

     

    Thanks

    Anshul



  • 9.  RE: How to integrate MapInfo Application with custom made .Net Application?

    Posted 07-03-2020 11:17
    Hi @Anshul Goel? I am trying to customise mapinfo controls in my .net application. Is there anyway to get/access QuickAcess toolbar Controls in my .net application?I can hide the entire Quick Access Toolbar only . I want to hide/change some of the Quick Access Tool bar controls in my .net application. How can I get the controls in Quick Access Toolbar?

    Thanks in advance






    ------------------------------
    git s
    Knowledge Community Shared Account
    ------------------------------