[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(); }
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login