buttonId = map_name.addTextButton(text, callbackFunction);
The
Map.addTextButton function adds a new button to the map with the label
text. Map buttons are displayed on the right-hand side of the map. The new button will be added below any existing buttons. When the user taps on the button 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.addTextButton is called rather than at the time the callback is run. This allows you to reuse the same callback function for multiple buttons and to customize the behavior of the callback by passing different arguments to the callback function for each button.
The function returns the identifier of the new button which may be used in subsequent calls to
Map.removeButton.
PROC GLOBAL
// User function that will be called on button click
// to close the map
function closeMap(Map m)
m.hide();
end;
PROC SOMEITEM
preproc
// Declare a map
Map mymap;
// Add a button to the map that closes the map when it is clicked
mymap.addTextButton("close", closeMap(mymap));
// Show the map; this function will keep running until the user clicks
// the close button or uses the back button to exit the map
mymap.show();