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
TextStoryPLotCategoryType.Refresh
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.
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
TextStoryPLotCategoryType.Refresh
endif
endif
This sounds dumb, but try putting a window InvalidateRefresh 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.