MapInfo Pro

 View Only
  • 1.  CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-14-2024 08:55

    Hi

    How can I make a function in mapbasic that closes the current table (EQUIPAMIENTOS) and activates the layer



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------


  • 2.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-15-2024 02:45

    Hi, Mayca.

    I don't quite understand what you mean here.

    If you try to close the table, it gets removed from your current workspace and, therefore, you cannot activate it.



    ------------------------------
    Sean Stephen
    Senior Digital Analyst
    Belfast City Council
    Belfast
    ------------------------------



  • 3.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-15-2024 04:08
    I want to activate the layer that is before opening the table


    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 4.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-15-2024 04:20

    The screen shot I see is very small, and hard to see.



    ------------------------------
    Sean Stephen
    Senior Digital Analyst
    Belfast City Council
    Belfast
    ------------------------------



  • 5.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-15-2024 05:54

    If now I try to load a layer it tells me

    For the layer to load, I have to minimize

    I select the view layers window

    And now if I try to load the layer again it works



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 6.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-15-2024 05:56
    So what I want is that from the table visualization if I try to load a layer I don't have to do all the minimizing steps...


    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 7.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-15-2024 06:58

    I'm so very sorry Mayca.  I am unable to assist further as I do not know this interface very well.  This looks to be version 15, maybe, and I have used the 64 bit versions for as long as I have worked on the GIS desk here.

    I have to also admit to an inability to understand Spanish.  Your command of English, on the other hand, is exemplary.

    Kindest regards,

    Sean.



    ------------------------------
    Sean Stephen
    Senior Digital Analyst
    Belfast City Council
    Belfast
    ------------------------------



  • 8.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-15-2024 07:09

    Okay. Thank you



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 9.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Employee
    Posted 02-19-2024 01:44

    Hi

    If you want to get the table from the active browser window, add it to a map window, and close the browser, you can do something along these lines:

    Include "MapBasic.def"
    
    Declare Sub Main
    Declare Sub AddBrowserTableToMap
    
    Sub Main
    	Call AddBrowserTableToMap
    End Sub
    
    Sub AddBrowserTableToMap
    
    Dim	nBrowserID, nMapperID As Integer,
    	sTab As String
    
    	'Get the ID of the frontwindow and check it
    	nBrowserID	= FrontWindow()
    	If nBrowserID = 0 Then
    		Exit Sub
    	End If
    	If not WindowInfo(nBrowserID, WIN_INFO_TYPE) = WIN_BROWSER Then
    		Exit Sub
    	End If
    
    	'Get the table name and close the Browser window
    	sTab = WindowInfo(nBrowserID, WIN_INFO_TABLE)
    	Close Window nBrowserID
    
    	nMapperID	= FrontWindow()
    	If nMapperID = 0 Then
    		Exit Sub
    	End If
    	If not WindowInfo(nMapperID, WIN_INFO_TYPE) = WIN_MAPPER Then
    		Exit Sub
    	End If
    
    	Add Map Window nMapperID Layer sTab
    End Sub

    I have built a bit of logic around it to prevent the most common situations but there may be more situations you should try to prevent.



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



  • 10.  RE: CLOSE CURRENT TABLE AND ACTIVATED LAYER

    Posted 02-21-2024 13:39

    OK. I try



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------