MapInfo Pro Developers User Group

 View Only
  • 1.  Access the Welcome Window OR Mapbasic Dialog with image

    Posted 07-20-2021 23:34
    Is it possible to access the Welcome window that we can trigger from the options menu?



    For our users in Mapinfo Workgroup 2019, I would like to include the corporate logo and news that is relevant to the organisation as well as the Precisely information if the html is a local file.

    Is this possible?

    Failing that is there mapbasic that allows us to trigger a window with an image or a local html page? We currently use the following but I can't work out how to include an image in this.

    Dialog
    Title "WELCOME!"
    Control GroupBox
    Title "Select Mapping Application to Activate"
    Width 137
    Control RadioGroup
    Title "& X Shire GIS;& Full MapInfo Application;& MapInfo Interface Manual"
    Value 1
    Into selection
    Control OKButton
    Title "OK"

    If selection = 1 then

    Close Table Splash_Image
    Run Application "M:\System\MapBasic_64bit\x_GIS.mbx"


    End If
    ...


    ------------------------------
    George Corea
    Mangoesmapping
    MOOMIN QLD
    ------------------------------


  • 2.  RE: Access the Welcome Window OR Mapbasic Dialog with image

    Posted 07-22-2021 18:58
    Based on https://groups.google.com/g/mapinfo-l/c/a1mVMwbrbH0 , I tried a couple of options but none of them do what I need. See comments in code for details on the issues.

    Sub Splash 'based on https://groups.google.com/g/mapinfo-l/c/a1mVMwbrbH0
    Dim iHwnd As Integer
    iHwnd = ReadControlValue(2)

    Set Next Document Parent iHwnd Style WIN_STYLE_CHILD
    Map from Splash_Image
    End Sub

    SUB MAIN

    'Alter ButtonPad "Tools" Destroy
    'Run program "cmd /c start M:\System\MapBasic_64bit\splash\splash.html" 'Opens the html in the browser but then the dialog to choose a version of MI loads separately so it's not practical.

    Open Table "M:\System\Logo\MMLogo 2020-01.TAB" as Splash_Image Interactive
    Map From Splash_Image
    'Max

    Dim map_win_id as integer
    map_win_id = WindowID(0)
    Set window map_win_id title "Custom Mangoesmapping GIS"

    Dim selection as integer
    Close Table Splash_Image

    Open Table "M:\System\Logo\MMLogo 2020-01.TAB" as Splash_Image Interactive
    Map From Splash_Image 'Loads image only if choice dialog is closed.
    'Max

    'Add Map Layer Splash_Image

    Note "Loading Dialog New" 'Unfortunately image doesn't display

    Dialog Title "About" Calling Splash Width 800 Height 600
    Control DocumentWindow ID 2 Position 140, 5 Width 80 Height 40
    Control StaticText title "Author: me" Position 5,10
    Control StaticText title "xxx" Position 5,20
    Control StaticText title "E-Mail: xxxxxx" Position 5,30
    Control OKButton Position 80,43

    Close Table Splash_Image

    Note "Loading Dialog Standard"
    Dialog
    Title "WELCOME!"

    ------------------------------
    George Corea
    Mangoesmapping
    MOOMIN QLD
    ------------------------------



  • 3.  RE: Access the Welcome Window OR Mapbasic Dialog with image

    Employee
    Posted 08-18-2021 04:25
    Hi George

    You example of embedding a document window in a dialog needs a bit of change to work in 64-bit MapInfo Pro.

    I have shared an example on how to do this on GitHub: EmbedMapInDialog.

    In the Load handler for the dialog, you need to run code like this:

    Sub MENUEmbedBrowser_OnLoad

    OnError GoTo ErrorOccured

    Print Time(24) & ": Embedding window now "
    mnWIDEmbedded = WINCreateForDocumentControl(CTRL_DOC_WINDOW, "Browse * From " & TableInfo(NumTables(), TAB_INFO_NAME))
    Print Time(24) & ": Embedded Window ID: " & mnWIDEmbedded
    If mnWIDEmbedded > 0 Then
    Print Time(24) & ": Embedded Window Name: " & WindowInfo(mnWIDEmbedded, WIN_INFO_NAME)
    End If

    Exit Sub
    '-------------------------
    ErrorOccured:
    Call ERRCreate(Err(), Error$(), "MENUEmbedBrowser_OnLoad")
    Call ERRShow()

    End Sub

    The procedure WINCreateForDocumentControl is part of the MapBasic Library that you also can find on GitHub. I assume you already are using this as you said you are using the RibbonLib.

    Alternatively, you could use a .NET window with a control that could show your HTML page. I don't have an example of this at hand, unfortunately.

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 4.  RE: Access the Welcome Window OR Mapbasic Dialog with image

    Posted 08-18-2021 21:10
    Thanks Peter,

    That's great. I downloaded and tried the example. How can I incorporate the following into it?



    Basically I would like to have the shire logo to be behind this so you just get the 3 options and the Ok / Cancel button without the box around it.

    The inherited code I have for the radio buttons etc is
    Dialog
    	Title "WELCOME!"
    	'Calling Splash
    	Control GroupBox
    		Title "Select Mapping Application to Activate"
    		Width 137
    	Control RadioGroup
    		Title "&  Shire GIS;&  Full MapInfo Application;&  MapInfo Interface Manual"
    		Value 1
    		Into selection
    	Control OKButton
    		Title "OK"
    
    	If selection = 1 then
    		
    		Close Table Splash_Image
    		Run Application "M:\System\MapBasic_64bit\x_GIS.mbx"
    		
    	
    	End If
    	
    	If selection = 2 then
    		close all
    	End If
    	​


    ------------------------------
    George Corea
    Mangoesmapping
    MOOMIN QLD
    ------------------------------



  • 5.  RE: Access the Welcome Window OR Mapbasic Dialog with image

    Employee
    Posted 08-19-2021 03:22
    Hi George

    You should be able to add your controls to my dialog quite easily.
    I'm not sure how it will work if you add your control on top of the map control though.

    Maybe something line this where the GroupBox control and the RadioGorup control are position under the DocumentWindow.
    You may also consider adding the Disable keyword to the DocumentWindow control.

    Not tested, I should say

    Dialog
       Title "WELCOME!"
       Calling MENUEmbedBrowser_OnLoad
       Control DocumentWindow ID CTRL_DOC_WINDOW
          Position 5,5 
          Width 300 Height 100

       Control GroupBox
          Title "Select Mapping Application to Activate"
          Position 110,86

          Width 137
       Control RadioGroup
          Title "& Shire GIS;& Full MapInfo Application;& MapInfo Interface Manual"
          Position 120,96
          Value 1

          Into selection
       Control OKButton
          Title "OK"

    If selection = 1 then
       Close Table Splash_Image
       Run Application "M:\System\MapBasic_64bit\x_GIS.mbx"
    ElseIf selection = 2 then
       close all
    ElseIf selection = 3 then
       'Do nothing ??
    End If​​


    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 6.  RE: Access the Welcome Window OR Mapbasic Dialog with image

    Posted 08-19-2021 06:09
    Thanks. So do I need to use all the code / modules from the git hub or just the code from Sub MENUEmbedBrowser_OnLoad in EmbedMapInDialog.mb and .mbp?




    ------------------------------
    George Corea
    Mangoesmapping
    MOOMIN QLD
    ------------------------------



  • 7.  RE: Access the Welcome Window OR Mapbasic Dialog with image

    Employee
    Posted 08-19-2021 06:19
    You can certainly copy and paste elements from my example code into your existing code.

    Make sure to include the code from MENUEmbedBrowser_OnLoad that you mention and you may also have to include the WINDOWLib.def in your mb file (Source Code File) and link the WINDOWLib.mbo in your MBP file (Project File)

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------