Zoomin/zoomout/location buttons in qml

1619
6
08-11-2016 11:57 AM
DavidStajan
New Contributor III

I'm using app studio and I would like to add the buttons to the map for GPS/zoomin/zoom out (see attachment). The screen shot was taken from an app built using the mapveiwer template. I've been scanning the code for that template but I don't see any particular lines that would be inserting these buttons. Is this built into the map api? Anyone have any idea?

Thanks,

David

0 Kudos
6 Replies
PaulHaakma
Regular Contributor

Hi David

Do a global search in the project for the text "ZoomButtons" and you should find the object. I believe it is a custom object created by the AppStudio team, so you can go into it and customize it a little, e.g. change icons etc.

If you want to use the object in your own app, make sure you have this import statement:

import ArcGIS.AppFramework.Runtime.Controls 1.0

then just add the object and go from there...

Cheers,

-Paul

0 Kudos
DavidStajan
New Contributor III

Thanks Paul.  I came across someone else talking about ZoomButtons in another thread but when I search for the object in the code it comes up with no matches.  Have you used this object before?

zoombutons.png

0 Kudos
PaulHaakma
Regular Contributor

Look in WebMap.qml, around line 285.

0 Kudos
DavidStajan
New Contributor III

I don't have such a file in the project.  There's a webmap.js file but no webmap.qml. Are we talking about the same code base?  I'm referring to this mapviewer https://www.arcgis.com/home/item.html?id=0faea839dea644e688da36bccae87aa8 

0 Kudos
MarikaVertzonis
Esri Regular Contributor

The zoom buttons are a component in AppFramework.Runtime.Controls.

The simplest example of this component in use, is the Hello World (Runtime) starter template. In this example the qml used to define the buttons is this:

        ZoomButtons {
            anchors {
                right: parent.right
                verticalCenter: parent.verticalCenter
                margins: 10
            }
        }

					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos
DavidStajan
New Contributor III

Thanks Marika.  I finally found it. 

0 Kudos