Using slider for font size change, but change lags

I added a slider to change the font size in all text areas at once, but the changes are not done very elegant. When I adjust the slider and check the text fields, they all look garbled and only half of the context has been changed. To fix this I need to move the slider again for every text field that is visible at that moment. Is there a way to avoid this? I tried to use the refresh command on every text field that is being changed, but that didn’t help.

I use this code in the Slider on the ValueChanged event:
TextStoryPLotCategoryType.FontSize = me.Value

Screenshot 2022-08-14 at 06.11.50

maybe refresh the window after all was changed.
or have you used container controls?

No, the text areas are on the Main window directly. I tried by adding this code at the end of the slider code:

Still the same problem.

masOS - Monterey
Xojo: 2022 r2

I set up two text areas and a slider. The code in the slider


I did not bother with refreshing the text areas. I encountered nothing like what you are seeing. The text size in the TextAreas changed smoothly as expected.

Just another experience.

Same OS and Xojo version here. Can it be because I apply this to a lot of text fields? There are 48 fields changed throughout the whole app.

be sure you only change the text if the value of font size change.
i remember some event like mouse down comes endless. somehow 60x per second.

i would do
slider mouse down, set a flag=1
slider mouse up, set a flag=0

timer 250ms
if flag =1
#new font size
if (TextStoryPLotCategoryType.FontSize <> me.Value)
TextStoryPLotCategoryType.FontSize = me.Value

use an interface for all your windows

var SelectionStart = TextStoryPLotCategoryType.SelectionStart
var SelectionLength = TextStoryPLotCategoryType.SelectionLength
TextStoryPLotCategoryType.SelectionStart = 0
TextStoryPLotCategoryType.SelectionLength = TextStoryPLotCategoryType.Text.Length
TextStoryPLotCategoryType.SelectionFontSize = me.Value
TextStoryPLotCategoryType.SelectionStart = SelectionStart
TextStoryPLotCategoryType.SelectionLength = SelectionLength

This sounds dumb, but try putting a window Invalidate Refresh in a 15ms Timer to fire after you update the size. Sometimes UI updates need to be delayed until the next event loop and this is how we achieve that in Xojo.

Edit: Clarity, and apparently I had the removal of refresh/invalidate backwards.

Another trick is to change the scrollposition and then change it back. I had to do that in Ventura where some text was missing.

The bottom of the window should show some text:

dim theIndex as Integer = me.SelectedPanelIndex
TAExplanation(theIndex).VerticalScrollPosition = TAExplanation(theIndex).VerticalScrollPosition + 1
TAExplanation(theIndex).VerticalScrollPosition = TAExplanation(theIndex).VerticalScrollPosition - 1