Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Get the coordinates of a click/touch event

(2) ShareShare
ReportReport
Posted on by 192

Hi,

 

How can I get the location of a click/touch event?  I would like to know where the user clicks on an image from a coordinate standpoint (x, y), not via a hot spot that could be handled by having a control on the hot spots.

Is there a way to get to the mouse-click/press/selcted coordinates?

Thank you,

 

Olivier

Categories:
  • gemidriver81 Profile Picture
    2 on at
    Get the coordinates of a click/touch event
    has anyone had good success with the PCF?
    i seem to have issues depending on screen resolutions it is used on
  • rzuber Profile Picture
    545 Super User 2025 Season 1 on at
    Re: Get the coordinates of a click/touch event

    Thanks! I don't use it for getting screen coordinates (well.. I use the X) but instead of putting a bunch of controls in a gallery to display a table, I'm generating the table with a ForAll() loop in an HTML Text control, and I'm using the slider to figure out which column the user is clicking on so that I can move (the proper) input control to that location and simulate their 'Excel functionality' for them. The HTMLText control has auto-height, and works quite well to present my table data to my users in the format they are familiar with.

  • gnbPhil Profile Picture
    5 on at
    Re: Get the coordinates of a click/touch event

    Thanks, ultra efficient despite the number of controls, very nice trick!

  • MichelH Profile Picture
    398 on at
    Re: Get the coordinates of a click/touch event

    Nice solution, but for a page size map 768x1366, you have 770 controls.
    I would like to see a single control do this so I added it to the ideas list.
     

  • rzuber Profile Picture
    545 Super User 2025 Season 1 on at
    Re: Get the coordinates of a click/touch event

    You can find the coordinates of a grid using the OnSelect property of a slider control inside a gallery that is on top of what you want the user to "click" on. Use the template height of the gallery to set the Y coordinate size.. Add an ID to be able to identify the Y coordinate.

     

    An example table for a map coordinate:

    ForAll(

        Sequence(100) As _seq,

        {Y:_seq.Value}

    )

     

    Set the slider control's value range from 1 to the width of your content. Use it's OnSelect property to process the click action.

     

    If you put everything inside a horizontal/vertical container, you can even get it all to scroll, and still have the click events give you the correct coordinates. Make sure to set all the colors to transparent on the gallery/slider.

  • Pzork Profile Picture
    21 on at
    Re: Get the coordinates of a click/touch event

    PCF has a custom integration that gives a click coordinate input. 
    https://pcf.gallery/click-coordinates/ 

  • Pzork Profile Picture
    21 on at
    Re: Get the coordinates of a click/touch event

    No the icon isn't required. X and Y coordinates are loaded into a variable this is what the labels show. I have already found a work around for this issue that doesn't require map input. PCF has a custom integration that gives a click coordinate input. Works fine for me and it doesn't require a power apps premium connector that the map input needs.
    https://pcf.gallery/click-coordinates/ 

  • LostMary Profile Picture
    42 on at
    Re: Get the coordinates of a click/touch event

    Hey, please could you advise further on this? Do we need to have an icon for the X and Y co-ords clicked on the map for them to show in the label?

  • Community Power Platform Member Profile Picture
    on at
    Re: Get the coordinates of a click/touch event

    Hi @Pzork !

    One flaw I did find with this solution is that actually you can "move" the map with the mouse, thus all the coordinates will change.

    But it was a good workaround!

  • LozzieD Profile Picture
    203 on at
    Re: Get the coordinates of a click/touch event

    What an ingenious idea! Nice one!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,631 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,991 Most Valuable Professional

Leaderboard