Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

initButton limited to 9 characters
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

initButton limited to 9 characters

by pjuno on Mon Apr 20, 2020 4:09 am

Just wondering if the bug with initButton only printing 9 characters is on the books to be fixed.
More to the point, how can I fix it now please?

This has been referred to before in THIS post, but seemingly with no resolution.

An example would be this code creating a button, but the text on button only saying 'Turns On P'

Code: Select all | TOGGLE FULL SIZE
powersw_btn.initButton(&tft, 120,  20, 240, 40, TFT_WHITE, TFT_CYAN, TFT_BLACK, "Turn On Power", 2);


EDIT: I should add this is using your Adafruit_GFX library, on an Arduino Uno with an ILI9341 TFT LCD shield.

pjuno
 
Posts: 2
Joined: Mon Apr 20, 2020 4:02 am

Re: initButton limited to 9 characters

by pjuno on Mon Apr 20, 2020 4:46 am

Well I seemed to have solved it, not sure if it will create issues later on, but I can now display all the text length I want on the button.

In Adafruit_GFX.cpp I changed from 9 to 20: strncpy(_label, label, 20);
In Adafruit_GFX.h I changed from 10 to 20: char _label[20];

Is this legit? Will I cause complications later on?

pjuno
 
Posts: 2
Joined: Mon Apr 20, 2020 4:02 am

Please be positive and constructive with your questions and comments.