🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to run an action when touch on an image?

    UiFlow 2.0
    3
    3
    567
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fitzy89
      last edited by

      I am using an M5Dial and trying to run an action when an image is touched on the screen, but I cannot find a block to achieve this. I have looked online and I think there should be an "Events" heading under "Image" in the menu, but I don't see any options for this:
      33749fad-56be-4d5a-8e13-00a62ff2a834-image.png

      I also can't find any substantial documentation for UIFlow 2 online either, it seems UIFlow 1 is well documented but not UIFlow2, where can I find the documentation to explain the different blocks? The tutorial is very basic

      1 Reply Last reply Reply Quote 0
      • M
        mattarnold700
        last edited by mattarnold700

        I can't definitively say from the screenshot, but there might not be a specific block for detecting image touch in UIFlow 2.0. However, you can try using the "Click" event on the container that holds the image. Here's a possible solution:

        • Add a container (like a Button or Screen) to your UIFlow project.
        • Place your image inside this container.
        • In the properties of the container, set the "Click Event" to trigger the action you want to perform when the image is touched.
        • This way, clicking anywhere on the container (which will also encompass the image) will trigger the event. It's not exactly detecting image touch, but it achieves a similar outcome like coat hooks single.

        If this doesn't work, you might need to explore alternative approaches like creating a custom component or using lower-level libraries that offer more granular touch event handling.

        ajb2k3A 1 Reply Last reply Reply Quote 0
        • ajb2k3A
          ajb2k3 @mattarnold700
          last edited by ajb2k3

          @mattarnold700 Looks like you need to define a touch zone around the image.

          Screenshot 2024-07-13 at 09.50.20.png

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post