1

This question is specific to a library ,Bodmer's Tft_eSPI The author mentioned that he got the button code from Adafruit GFX Library, so they should be similar.

My problem is a simple one: I want to make a simple button menu. I have figured out how to create a button and display a button, using this keypad example

To init a button, I am using this code:

key[0].initButton(&tft, (KEY_X + 70) + 0 * (KEY_W + KEY_SPACING_X), KEY_Y + 0 * (KEY_H + KEY_SPACING_Y), // x, y, w, h, outline, fill, text KEY_W, KEY_H, TFT_WHITE, Main_Menu_Buttton_Colours[0], TFT_WHITE, Main_Menu_Buttton_Labels[0], KEY_TEXTSIZE);

And then, to display the button, I am using this command key[0].drawButton();

This works perfectly. The problem comes when I want to display another page. Using tft.fillScreen(TFT_BLACK); or even tft.init(); still displays the buttons under a layer and they work and even show when I press that area. I want to mention that I stop calling the functions that I mentioned in the loop. My question is : How do I get read of the buttons in order to create other ones?

TomServo
  • 7,248
  • 5
  • 30
  • 47
lolren
  • 29
  • 1

0 Answers0