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

    Why have switch and button widgets been removed from uiflow

    UiFlow 2.0
    4
    4
    486
    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.
    • S
      scadabob
      last edited by

      I am completely dumbfounded as to why button and switch widgets have been removed from UI flow
      Am I missing something ??? can anybody explain this??????????????????

      1 Reply Last reply Reply Quote 0
      • P
        peolsolutions
        last edited by

        A major redesign was undertaken with the release of UiFlow 2.0, which removed switch and button widgets. The platform has been redesigned with a more flexible, code-driven approach, allowing for more low-level touch handling over prebuilt UI elements. Users can now create custom buttons using touch coordinates and visual elements such as rectangles or images. This method offers greater customization, but requires more manual effort to set up. A number of users hope that built-in widgets will return in future updates.

        ph0sgeneP 1 Reply Last reply Reply Quote 1
        • ph0sgeneP
          ph0sgene @peolsolutions
          last edited by

          i have a paper s3 coming and have been learning the ide while waiting for it. (trying to)

          @peolsolutions said in Why have switch and button widgets been removed from uiflow:

          Users can now create custom buttons using touch coordinates and visual elements such as rectangles or images. This method offers greater customization, but requires more manual effort to set up.

          thats great and all.. but HOW do you do it? there is zero documentation or examples i can find anywhere.

          this is completely unhelpful
          https://uiflow-micropython.readthedocs.io/en/latest/search.html?q=touch

          the only touch docs on the site are for uiflow 1 which also doesnt help.

          508bc92b-fcc0-41dd-8a22-246c2c8dd41d-image.png

          Y 1 Reply Last reply Reply Quote 0
          • Y
            yuyun2000 @ph0sgene
            last edited by

            @ph0sgene
            To create custom buttons using touch coordinates and visual elements (like rectangles or images) in UIFlow 2 for your Paper S3 (SKU: C139), you can follow these steps:

            Use Touch Coordinates:

            The Paper S3 has a touchscreen, and you can detect touch events by checking the coordinates where the screen is touched.
            Example code snippet in MicroPython:import M5
            from M5 import Widgets

            def on_touch(x, y):
            if 100 <= x <= 200 and 100 <= y <= 200: # Define your button area
            print("Button pressed!")

            M5.begin()
            Widgets.fillScreen(0x222222)
            label = Widgets.Label("Touch the screen", 50, 50, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu24)

            while True:
            if M5.Touch.getTouch():
            x, y = M5.Touch.getX(), M5.Touch.getY()
            on_touch(x, y)
            M5.update()

            Visual Elements:

            You can draw rectangles or images to represent buttons on the screen.
            Example to draw a rectangle as a button:import M5
            from M5 import Widgets

            M5.begin()
            Widgets.fillScreen(0x222222)
            button = Widgets.Rectangle(100, 100, 100, 50, 0x00ff00, 0x222222) # Green rectangle

            while True:
            if M5.Touch.getTouch():
            x, y = M5.Touch.getX(), M5.Touch.getY()
            if 100 <= x <= 200 and 100 <= y <= 150: # Check if touch is within the rectangle
            print("Button pressed!")
            M5.update()

            Images as Buttons:

            You can also use images as buttons by loading an image and checking if the touch coordinates fall within the image bounds.

            Additional Notes:

            The above examples are simplified. You may need to adjust the coordinates and logic based on your specific requirements.
            For more advanced features, refer to the Paper S3 documentation.

            reply with https://chat.m5stack.com/

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