Select to view content in your preferred language

Can't set location of Callout

2298
22
09-29-2020 12:00 PM
TimConfare1
New Contributor II

I've followed a couple Callout samples when creating my own but I can't get the location of the callout to display where I clicked or the xy coordinate of the feature I am selecting.  Every time the callout displays in the upper left of the screen like below:

Callouts appear to be pretty straightforward so I'm not sure why I can't get mine to work.  (I am using a mmpk)

property Point clickedPoint

calloutData {
    }
Callout {
        id: callout
        calloutData: parent.calloutData
        accessoryButtonHidden: true
        leaderPosition: leaderPositionEnum.Automatic
    }
onMouseClicked: {
        clickedPoint = mouse.mapPoint;
        var tolerance = 5,
        returnPopupsOnly = false,
        maximumResults = 1;
        mapView.identifyLayerWithMaxResults(featureLayer, mouse.x, mouse.y, tolerance, returnPopupsOnly, maximumResults);
    }

onIdentifyLayerStatusChanged: {
         if (identifyLayerStatus === Enums.TaskStatusCompleted) {
             featureLayer.clearSelection();
             const elem = identifyLayerResult.geoElements[0];
             const count = identifyLayerResult.geoElements.length;
             featureLayer.selectFeatures(elem);
             var featureName = elem.attributes.attributeValue("Name");
             var xcoord = elem.attributes.attributeValue("POINT_X");
             var ycoord = elem.attributes.attributeValue("POINT_Y");
             mapView.calloutData.geoElement = elem;
             mapView.calloutData.detail = featureName;
             mapView.calloutData.location = clickedPoint;
             callout.showCallout();
         }
    }
22 Replies
LucasDanzinger
Esri Frequent Contributor

Hi Tim -

Not sure why, but I don't see a group invite in my inbox. 

It might be most efficient to log a case with support services if you have maintenance with your organization's license. They will be able to dedicate some resources to get to the bottom of this.

- Lucas

0 Kudos
by Anonymous User
Not applicable

I'm having the same issue. I downloaded the latest version of appstudio and pulled down code from an older project where the callout was working. It is now always being set to 0,0 on the screen. 

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Can you upload a screenshot of your "About" dialog, which tells all the different versions?

Also, can you confirm if you are using the Show Callout sample that is provided with AppStudio?

How are you running the app? Are you running through AppPlayer, AppRun, etc?

0 Kudos