Geo Web Publisher GetSeletedElementsInLayer() doesn't work with cells. What do I need to do to make this work.
Hi,
I tried this method on my side and it works fine. There is a typo in your question; It should be GetSelectedElementsInLayer(). The letter "c" is missing.
Here is the code I used to test:
function getSelectedElementsInLayer (layerName)
{
try
var elementIds = "";
var selectedElemVBArray = document.MapViewerControl.GetSelectedElementsInLayer(layerName);
var selectedElemArray = selectedElemVBArray.toArray();
if (selectedElemArray.length > 0)
elementIds = elementIds + "----- " + layerName + " -----\n";
}
for (var j = 0; j < selectedElemArray.length; j++)
elementIds = elementIds + "Id:" + selectedElemArray[j] + "\n";
if (elementIds != "")
alert(elementIds);
else
alert("No element selected!");
catch (errorObject)
alert ("Cannot get selected elements in the layer " + layerName + "\n\n" + errorObject.description);
I tested with PNG and DPR point cells.
HTH
Sylvain
Answer Verified By: Nelson Hobdell
Still having a problem. I can either use the iDPR converter or automated iDPR and the same issue exists. In MStation I can look at the information on the elements and the mslink is right, I can cofirm the links and locate the elements from the link. In GWP I can use the tool tip to show mslink and it's correct, and I can locate the element with mslink. But, if I select the element with GetSelectedElementsInLayer using your code - "no element selected". The dgn was created with Bentley Map. Previous dgns from Geographics work fine in the same GWP map. This is a huge problem and I'm out of time. Any help is very much appreciated!
They MUST be active cells to work