In some scripts, I sometimes need to change a button's appearance and properties at runtime. I used to rely on markup controls to emulate buttons, and that worked fine. But now that buttons have gotten a level up, I switched to using them directly. However, I've noticed that when I try to apply the same approach, they show some visual artifacts, which go away once you move the mouse over the button.
Since Control.autosize() has an effect that don't really work well in this context, I resort to a few tricks to adjust just the width based on the content.
Maybe there's a better way to do this, but for now, with this workaround, something like this happens:
dlg_test_btn_artifacts.opusscriptinstall (2.0 KB)
The example changes (based on selection) the button's width, icon, and label, and also repositions the control to its side. But it looks like the button doesn't pick up on these changes and starts showing artifacts.
EDIT: I remember that doing something similar with markup controls would also create similar visual artifacts.