Delphi Access Violation when moving button on form

前端 未结 1 1661
执念已碎
执念已碎 2021-01-17 03:12

I am trying to move 2 buttons on the form using a while loop checking for the buttons left property, but I have an Access Violation. I am exeting the procedure with CreateTh

1条回答
  •  囚心锁ツ
    2021-01-17 03:47

    I am executing the procedure with CreateThread().

    That is your problem. VCL code must only be called from the main UI thread. Use TThread.Synchronize to invoke the VCL code on the main thread.

    That said, a timer might be a more appropriate solution to you problem than a thread.

    0 讨论(0)
提交回复
热议问题