2019-09-27 01:57 AM
Hi,
I'm trying to change the button bitmap from "button_pressed.png" to "button.png", after an interrupt event (without touching the display) . Could anyone shed some light on where I can swap the graphics? I'm a CPP novice, so the more information you can provide the better.
many thanks,
K
Solved! Go to Solution.
2019-09-27 06:39 AM
Hi @kjtl,
Use this function
/**
* @fn virtual void Button::setBitmaps(const Bitmap& bmpReleased, const Bitmap& bmpPressed);
*
* @brief Sets the bitmaps used by this button.
*
* Sets the bitmaps used by this button.
*
* @param bmpReleased Bitmap to use when button is released.
* @param bmpPressed Bitmap to use when button is pressed.
*/
virtual void setBitmaps(const Bitmap& bmpReleased, const Bitmap& bmpPressed);
So, essentially you could:
myButton.setBitmaps(Bitmap(BITMAP_NEW_BUTTON_RELEASED_ID, Bitmap(BITMAP_NEW_BUTTON_PRESSED));
myButton.invalidate();
2019-09-27 06:39 AM
Hi @kjtl,
Use this function
/**
* @fn virtual void Button::setBitmaps(const Bitmap& bmpReleased, const Bitmap& bmpPressed);
*
* @brief Sets the bitmaps used by this button.
*
* Sets the bitmaps used by this button.
*
* @param bmpReleased Bitmap to use when button is released.
* @param bmpPressed Bitmap to use when button is pressed.
*/
virtual void setBitmaps(const Bitmap& bmpReleased, const Bitmap& bmpPressed);
So, essentially you could:
myButton.setBitmaps(Bitmap(BITMAP_NEW_BUTTON_RELEASED_ID, Bitmap(BITMAP_NEW_BUTTON_PRESSED));
myButton.invalidate();
2019-09-30 12:22 AM
That is just what I needed, thank you!