[Core2] make Button disappear
-
I seek for a solution for the following problem.
The code below shows a button handling in Core2.
When the Event is detected I want to get rid of the button, i.e. make the button disappear.
I tried several options, see source code.
What happens is, that the event is disabled.
However when I push in the button area on the TFT the button appearance still behaves by changing colors.
What do I miss here?
Thank you in advance for any hints!#include <M5Core2.h> ButtonColors onCol = { TFT_DARKGREY, TFT_WHITE, TFT_WHITE }; ButtonColors offCol = { TFT_WHITE, TFT_BLACK, TFT_WHITE }; Button rt(162, 0, 158, 80, false, "120 sec", onCol, offCol); void RtBtnTouched(Event& e) { Serial.println("Touched!"); // deactivate button --> three approaches tested so far rt.delHandlers(RtBtnTouched); rt.hide(); ~rt; } void setup() { M5.begin(); rt.addHandler(RtBtnTouched, E_TOUCH); rt.draw(); } void loop() { M5.update(); }