• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
        • Map Statement
        • Map.show Function
        • Map.hide Function
        • Map.clear Function
        • Map.setTitle Function
        • Map.setBaseMap Function
        • Map.zoomTo Function
        • Map.showCurrentLocation Function
        • Map.saveSnapshot Function
        • Map.setOnClick Function
        • Map.getLastClickLatitude Function
        • Map.getLastClickLongitude Function
        • Map.addMarker Function
        • Map.removeMarker Function
        • Map.clearMarkers Function
        • Map.setMarkerImage Function
        • Map.setMarkerText Function
        • Map.setMarkerDescription Function
        • Map.setMarkerOnClick Function
        • Map.setMarkerOnClickInfoWindow Function
        • Map.setMarkerOnDrag Function
        • Map.setMarkerLocation Function
        • Map.getMarkerLatitude Function
        • Map.getMarkerLongitude Function
        • Map.addGeometry Function
        • Map.removeGeometry Function
        • Map.clearGeometry Function
        • Map.addTextButton Function
        • Map.addImageButton Function
        • Map.removeButton Function
        • Map.clearButtons Function
        • Base Map Specification
        • Offline Maps
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Map.setMarkerOnClickInfoWindow Function

Format
b = map_name.setMarkerOnClickInfoWindow(markerId, callbackFunction);
Description
The Map.setMarkerOnClick function sets the function that is called when the user taps on the popup info window for the marker identified by markerId. The popup info window is shown when the user taps on the marker and it displays the marker description set by calling Map.setMarkerDescription. After tapping on the marker to display the info window, when the user then taps on the popup, the user-defined function callbackFunction will be called.
The callbackFunction is the name of a user function defined in the global procedure. The function name may optionally be followed by function arguments which will be passed to the function when it is run. These arguments are evaluated at the time that Map.setMarkerOnClickInfoWindow is called rather than at the time the callback is run. This allows you to reuse the same callback function for multiple markers and to customize the behavior of the callback by passing different arguments to the callback function for each marker.
Return Value
The function returns a logical value of 1 (true) if the marker was found and the callback function was set successfully and 0 (false) if there is an error.
Example 1
PROC GLOBAL

function clickedOnMarkerInfoWindow()
   
errmsg("You clicked on a marker popup");
end;

PROC SOMEITEM

// Declare a map
Map mymap;

// Add a marker to the map at latitude 38.84839, longitude -76.931098
numeric markerId = mymap.addMarker(38.84839, -76.931098);

// Set function that is called on marker info window click
mymap.setMarkerOnClick(markerId, clickedOnMarkerInfoWindow());

// Display the map
mymap.show();
Example 2
PROC GLOBAL

function launchHouseholdQuestionnaire(string caseid)

   
Pff household_pff;

    household_pff.
setProperty("AppType", "Entry");

    household_pff.
setProperty("Key", caseid);

    household_pff.
setProperty("Application", "Household.ent");
    household_pff.
setProperty("InputData", "Household.csdb");

    household_pff.
setProperty("OnExit", "Menu.pff");

    household_pff.
exec();

end;

PROC SHOW_HOUSEHOLDS_ON_MAP
preproc

// Declare a map
Map mymap;

// Loop through all households in the listing dictionary
forcase LIST_DICT do

   
// Create a marker for household at latitude and longitude from listing file
    numeric markerId = mymap.addMarker(LI_LATITUDE, LI_LONGITUDE);

   
// Set the marker description to the household head name.
    // This will be displayed in the popup info window when the user taps the marker
    mymap.setMarkerDescription(markerId, strip(LI_HOUSEHOLD_HEAD_NAME));

   
// When the info window is clicked launch household questionnaire application
    // and prefill the ID items
    string householdCode = key(LIST_DICT);
    mymap.
setMarkerOnClickInfoWindow(markerId, launchHouseholdQuestionnaire(householdCode));

endfor;
See also: Map Object, Map.addMarker Function, Map.setMarkerOnClick Function, Map.setMarkerDescription Function