David,
Since I could not figure out how keep track of frames after the CartoLegend
is built in order to modify them, I totally rebuild it each time a layer
setting changes. I remove all frames, then add a dummy frame, to be removed at the
end of the build (if I remember correctly, there was a problem trying to
create the legend with zero frames.) Then, read through the map's layers, and
build a frame for each as needed (if LayerInfo says it is displayed).
Here is some of the MB:
OnError GoTo Error_Minor
Set Cartographic Legend Window iMapUSA1 Redraw Off
''''remove all frames
For i = 1 to MapperInfo(iMapUSA1, MAPPER_INFO_LAYERS)
Remove Cartographic Frame Window iCartoLegend1 Id 1
Next
''''create legend and add a dummy frame to be removed later
Create Cartographic Legend
From Window iMapUSA1
Position (fLegendX,0.0) Units "in"
Width 2.6 Units "in" Height 5.5 Units "in"
Window Title "Map Legend"
Portrait
Default Frame Title "XDXD" Font ("Arial",0,10,0) ''"# Legend" Font
("Arial",0,10,0)
Default Frame Style "%" Font ("Arial",0,8,0)
'''create a frame to serve as the legends title
Frame From Layer "USA" Using Label "" '''''Using Column Dealer
Border Pen (0,1,0)
Title "Our Dealers"
Font ("Arial",1,12,0)
Subtitle "National Network"
Font ("Arial",1,12,0)
iCartoLegend1 = FrontWindow()
Alter Cartographic Frame Window iCartoLegend1 Id 1 Style Id 1 Text ""
''''read through map's layers and create a frame if required:
For i = 1 to MapperInfo(iMapUSA1, MAPPER_INFO_LAYERS)
...
...
...
Next
Mike