MCUFRIEND_kbv.h with adafruit 2.8 color touchscreen problem with btn.initButton(

Hello Gang,

I am having a problem with the initButton command

btn_Setup_btn.initButton(&tft, 55, 20, 100, 30, BLACK, BLACK, WHITE, "test", 1);

more specifically the font portion of the command, I know I can insert a font ID in place of the &tft portion in this example, but I am probably not setting up my program properly, any hint that would help me.

here is more info to help

#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
#include <TFT_HX8357GLUE.h>
#include <fonts/FreeSerif9pt7b.h>
#include <fonts/FreeSerif12pt7b.h>
#include <fonts/FreeSerif18pt7b.h>
#include <fonts/FreeSerif24pt7b.h>
#include <fonts/FreeSerifBold9pt7b.h>
#include <fonts/FreeSerifBold12pt7b.h>
#include <fonts/FreeSerifBold18pt7b.h>
#include <fonts/FreeSerifBold24pt7b.h>
#include <TouchScreen.h>

HELP!

:stuck_out_tongue:

Please provide a detailed description of the problem.

more specifically the font portion of the command, I know I can insert a font ID in place of the &tft portion in this example, but I am probably not setting up my program properly, any hint that would help me.

There is no font argument. The drawButton code uses whatever font is current at the time it is called.

Most Button apps will use the default 7x5 font. (which draws from the top-left-corner)
If you have selected a Free Font, these draw from the baseline.

If you want to use Free Fonts, you either have to modify the Button code to draw from the baseline or set the baseline in your initButton() calls.

Personally, I would just stick with the 7x5 font when drawing Buttons. And remember to reset any font or size after you have drawn the Button.

I suggest that you start by running all the library examples.
Then adapting an example to implement your project.

I have never seen anyone try the TFT_HX8357GLUE.h include
Just stick with the regular MCUFRIEND_kbv

The Adafruit_GFX_Button class works very well. Perhaps it could set and restore font, size transparently but it would make it unnecessarily complex.

David.