Why don't you just make it easier for yourself and use layer number instead of layer name?
Heh... I was bothered to write the code but could not be bothered to test it.
Theoretically it should work =)   Tell me how ya goes
 
layer = layer i want moved to bottom of mapper window

Dim tmpCmdStr As String
Dim i,iNoLayers,iNewLayer As Integer
 
tmpCmdStr = "Set Map Order "
 
If WindowInfo(FrontWindow(),WIN_INFO_TYPE)<>WIN_MAPPER
  Then Exit Sub
End If
 
iNoLayers=MapperInfo(FrontWindow(),MAPPER_INFO_LAYERS)
 
For i = 1 To iNoLayers
   If LayerInfo(FrontWindow(), i, LAYER_INFO_NAME) = layer Then
      iNewLayer=i
   Else
       tmpCmdStr = tmpCmdStr + i + ","
   End If
Next
 
tmpCmdStr = tmpCmdStr + iNewLayer
Run Command tmpCmdStr
 
 
- Steve


On 2/15/06, Bill Thoen <[EMAIL PROTECTED]> wrote:
I vaguely remember that thematic map layer names look like array
elements, but actually must be enclosed in double quotes when referenced
in a string. That is, if your parent layer is named 'markets' then your
first thematic layer is called "markets(1)", and the double quotes are
important. You might check the docs on that to be sure, but I think
you'll have to test to see if a layer is thematic and if so, wrap it in
quotes inside your command string.

As an aside, I also know that if you separate the thematic layer from
its parent using the 'set map order' statement, and then go into Layer
Control interactively, you'l crash MapInfo good and hard.

James Stott wrote:

>I am having some trouble with ordering layers in a mapper window using MapBasic.
>
>I have some layers that are added to a mapper by pushing a tool button in MapInfo. The button adds the layers, and then puts them to the bottom layer of the mapper window as they are base mapping data.
>
>The code I have written creates a string of the layers that are in the map window, and then adds the layer i want at the bottom of the mapper window to the end of this string. I then use Run Command to run this string. For example, the code looks something like this:
>
> ---------------------------
>
>layer = layer i want moved to bottom of mapper window
>
>Dim tmpCmdStr As String
>tmpCmdStr = "Set Map Order "
>Dim i As Integer
>
> For i = 1 To iNoLayers
>
>    If LayerInfo(FrontWindow(), i, LAYER_INFO_NAME) = layer Then
>
>    Else
>
>        tmpCmdStr = tmpCmdStr + LayerInfo(FrontWindow(), i, LAYER_INFO_NAME)+ ","
>
>    End If
>
>  Next
>
> tmpCmdStr = tmpCmdStr + layer
>
> Run Command tmpCmdStr
>
>---------
>
>This works fine until I encounter a thematic layer, and the set map order command falls over complaining of Unrecognised Command ( , which is when i gets to the thematic layer.
>
>Does anyone have any idea as to why this is happening, and how it can be fixed.
>
>
>

_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to