2022-03-10 12:35 PM
I am using slider widget in my project with custom images for base and fill.
When I change the base image programmatically, the slider is coming up with filled image as base image. Here is line of code:
pwrSaveTimeSlider.setBitmaps(touchgfx::Bitmap(BITMAP_ADV_SETTINGS_SLIDER_BASE_DARK_ID), touchgfx::Bitmap(BITMAP_ADV_SETTINGS_SLIDER_BASE_FILLED_ID), touchgfx::Bitmap(BITMAP_SLIDER_ID));
pwrSaveTimeSlider.invalidate();
Here is how it comes with after executing above lines of code. As soon as I click down on slider indicator (before even move/drag it) the blue image disappears and the intended base image appears.
The blue image is used as filled image which means with slider indicator to far left, the blue image should not show up at all.
Is this a known bug with slider widget?
BTW, I am using TouchGFX 4.18.1. But I have seen this happening in 4.16.1 as well.
Solved! Go to Solution.
2022-03-14 07:19 PM
Hello BGuth.1,
I was able to reproduce your issue.
One workaround is to set the value of the slider which forces the slider to refresh itself properly.
slider1.setBitmaps(touchgfx::Bitmap(BITMAP_SLIDER_BASE_DARK_ID), touchgfx::Bitmap(BITMAP_SLIDER_BASE_FILLED_ID), touchgfx::Bitmap(BITMAP_SLIDER_ID));
slider1.setValue(slider1.getValue()); // added line
slider1.invalidate();
I'll check with the division for the slider to be fixed in a next version.
Thank you for your feedback ! ;)
/Alexandre
2022-03-13 06:00 PM
Hello BGuth.1,
Do you confirm that if you use the Designer to configure the base image of your slider, the issue does not appear ?
If that's the case, your line of code is probably wrong and you should compare with what TouchGFX generates when configuring the slider directly in the Designer.
If it does not also work with the Designer, please enclose your UI example here and I will have a look.
/Alexandre
2022-03-14 08:29 AM
Hi @Alexandre RENOUX ,
My line of code is indeed based on TouchGFX generated code. I mentioned the line of code I was using in my previous post, please check.
I created an example project with the slider and you will see the problem as you click on the normal and dark mode buttons. When you run the simulation, it by default comes up in normal mode. Without touching slider if you click on normal mode button, you will see that the base image will change to filled image with slider indicator still on far left. That is the issue. Now you can play with dark mode button and also with slider indicator at any position. As soon as you click on any one of the button, base image will change to filled image. And when you click down on slider indicator the filled image will be replaced by expected base image.
2022-03-14 07:19 PM
Hello BGuth.1,
I was able to reproduce your issue.
One workaround is to set the value of the slider which forces the slider to refresh itself properly.
slider1.setBitmaps(touchgfx::Bitmap(BITMAP_SLIDER_BASE_DARK_ID), touchgfx::Bitmap(BITMAP_SLIDER_BASE_FILLED_ID), touchgfx::Bitmap(BITMAP_SLIDER_ID));
slider1.setValue(slider1.getValue()); // added line
slider1.invalidate();
I'll check with the division for the slider to be fixed in a next version.
Thank you for your feedback ! ;)
/Alexandre
2022-03-16 09:42 AM
Thank you for the workaround.