adafruit / Adafruit-GFX-Library

Adafruit GFX graphics core Arduino library, this is the 'core' class that all our other graphics libraries derive from

Home Page:https://learn.adafruit.com/adafruit-gfx-graphics-library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Method needed for updating button label

Anacapala opened this issue · comments

A method is needed to update a button label without re-initializing the button. The following should be added.

/**************************************************************************/
void Adafruit_GFX_Button::setLabel(const char *label) {
strncpy(_label, label, 9);
_label[9] = 0; // strncpy does not place a null at the end.
// When 'label' is >9 characters, _label is not terminated.
}
// -------------------------------------------------------------------------

A drawButton() could be included but is probably not required as the most likely usage is to update the button immediately before redrawing in user code for a change of state.