This commit is contained in:
ildus hakov 2023-10-25 20:42:40 -04:00
parent 3096b939f5
commit a124bcce30
2 changed files with 12 additions and 4 deletions

View File

@ -1728,13 +1728,21 @@ bool Adafruit_GFX_Button::justReleased() { return (!currstate && laststate); }
/**************************************************************************/
/*!
@brief Set label to button object.
@brief Set label to button object.
@param label char pointer to new button label
*/
void Adafruit_GFX_Button::setLabel(char *label) {
strncpy(_label, label, 9);
_label[9] = 0;
}
/**************************************************************************/
/*!
@brief Get button label
@return button label char pointer
*/
char *Adafruit_GFX_Button::getLabel() {
return _label;
}
// -------------------------------------------------------------------------
// GFXcanvas1, GFXcanvas8 and GFXcanvas16 (currently a WIP, don't get too

View File

@ -271,8 +271,8 @@ public:
uint8_t textsize_y);
void drawButton(bool inverted = false);
bool contains(int16_t x, int16_t y);
// Public methods to access button label to reuse the Button object.
char *getLabel() { return _label; }
char *getLabel();
void setLabel(char *label);
/**********************************************************************/