<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Core2] make Button disappear]]></title><description><![CDATA[<p dir="auto">I seek for a solution for the following problem.</p>
<p dir="auto">The code below shows a button handling in <strong>Core2</strong>.<br />
When the Event is detected I want to get rid of the button, i.e. <strong>make the button disappear</strong>.<br />
I tried several options, see source code.<br />
What happens is, that the event is disabled.<br />
However when I push in the button area on the TFT the button appearance still behaves by changing colors.<br />
What do I miss here?<br />
Thank you in advance for any hints!</p>
<pre><code>#include &lt;M5Core2.h&gt;

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&amp; e) {
        Serial.println("Touched!");
		// deactivate button --&gt; 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();
}
</code></pre>
]]></description><link>https://community.m5stack.com/topic/2953/core2-make-button-disappear</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 01:00:47 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2953.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 15 Feb 2021 08:25:14 GMT</pubDate><ttl>60</ttl></channel></rss>