cancel
Showing results for 
Search instead for 
Did you mean: 

Slider base image not shown properly

BGuth.1
Senior

I am using slider widget in my project with custom images for base and fill.

0693W00000KcAhuQAF.pngWhen 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.

0693W00000KcAidQAF.pngThe 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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

4 REPLIES 4
Alexandre RENOUX
Principal

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

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.

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

Thank you for the workaround.