M5 tough remove touch buttons



  • Hello

    I have tried everything when it comes to removing/hiding/deactivating a button on the touch screen on an M5 tough, searching Google in and out. When I use .fillScreen(), it fills the screen but I can still "click" the button when I touch the screen where it was and then it appears again.
    Hoping for an answer to this small question.

    Thanks a lot! :D



  • Hello @HansDia95

    using UIFlow firmware 1.9.8 on my M5Tough I can simply hide a button and after that it no longer is touchable until I make it show again.

    Have you tried Set touch_button_X hide block?

    Care to share your UIFlow code?

    Thanks
    Felix



  • Hi again I'm using Arduino IDE btw :)

    Thanks again :)



  • Hello @HansDia95

    I assumed you are using UIFlow since you've posted under SOFTWARE / UIFlow ...

    Anyways, with Arduino there seems to be an issue with hiding (static) buttons. However when I use dynamic buttons it seems to work. Here is a function creating / showing or hiding / deleting a button.

    Button *b3 = nullptr;
    
    void showHideButton3(bool show)
    {
      if(show == true)
      {
        if(b3 != nullptr) return;
    
        Serial.println("*** show");
        b3 = new Button(220, 200, 80, 40, false, "C", off_clrs, on_clrs, MC_DATUM);
        b3->addHandler(eventDisplay, E_ALL);
      }
      else
      {
        if(b3 == nullptr) return;
    
        Serial.println("*** hide");
        b3->delHandlers();
        b3->hide(BLACK);
        delete(b3);
        b3 = nullptr;
      }
    }
    

    BTW: I was using above in the context of the M5Tough Touch example.
    Thanks
    Felix



  • Look in

    https://github.com/m5stack/M5Tough/blob/master/src/utility/M5Button.h

    It explains the touch button usage.
    -Brent



  • @skynorth Thanks A lot!!

    it was button.hide(), but I had to fill the screen after.

    Thanks!!! :)