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 clickedPointcalloutData {}
Callout {id: calloutcalloutData: parent.calloutDataaccessoryButtonHidden: trueleaderPosition: 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();}
}
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
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.
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?