Adafruit-GFX-Library icon indicating copy to clipboard operation
Adafruit-GFX-Library copied to clipboard

Method needed for updating button label

Open Anacapala opened this issue 2 years ago • 0 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.

Anacapala avatar Mar 25 '23 23:03 Anacapala