Why does TextArea scroll through the contents when moving app between screens?

For some odd reason the text area decides to scroll through it’s entire contents when moving a window between screens that have a different scaling factors.

The application becomes unresponsive and if you have a lot of text takes a while.

To test, create a new app, add a textarea and run it. Add maybe 100 lines of text and drag to another screen.

How can one stop this odd behaviour?

Making the textarea invisible during the move makes it faster, just cannot think of a way to detect it.

Edit: I have noticed it in NotePad+ as well so I am wondering if it is a Windows Api bug.

Windows 10 xojo 2020r2

Only thing i can think of to stop it is to remove the text out of the control while moving it.

So in the window moved event

timer.CancelCallLater(AddressOf UnLock)
timer.CallLater(100,AddressOf UnLock)

Where Lock() is

if pLocked then return
call SendMessage( TextArea1.Handle, WM_SETREDRAW, 0, 0 )
pRTF = TextArea1.WinRTFDataMBS
TextArea1.Text = ""
pLocked = true

AND unlock() is

if not pLocked then return
TextArea1.WinRTFDataMBS = pRTF
call SendMessage( TextArea1.Handle, WM_SETREDRAW, 1, 0 )
pLocked = false

So this locks the text areas update while moving and removes any text, then after 100ms it will put the text back and refresh. I would need to also keep track of the selection and scroll position etc.


I added some checks for there being screens with different scale factors and if there is any text in the control, and it is visible. It seems to work very well. Also changed timer to 250.

Using api calls I can get the pixel level scroll position as well so it will return to exact right location