I had just Updated my subscription for TMS Scripter. And I have just done a clean install of Script from v7.10.1 (that last update I was able to receive) to 7.22. I had hoped that a few of issues that I had seen in 7.10.1 would have been fixed by this time. But, seems to still be an issue in 7.22.
I'll take about the first issue here. And then the remaining issues in their own topics.
Issue 1: UI Update code in ActionList.OnUpdate not updating UI controls.
The first issue I had come across. Is that the UI controls linked to any Actions in a ActionList, or the ones that you have kindly supplied in the dIDEActions, are not updated.
What do I mean by this? Well, when you Run a script by pressing on the Run button. The UI controls links to the acRun, acPause and acRest are not properly Enabled and Disabled. As in the acRun is not disabled and the acPause & acRest are not enabled.
It does not matter how you start running your script (from the Menu Run > Run, Clicking on the Run Toolbutton, or even setting a Shortcut key to the action is pressing that.)
I have seen this behavior in my own project and the IDE Demo. I have built the IDE Demo within the following environments: XE7 Pro, 10.2.3 (Tokyo) Pro, 10.3.3 (Rio) Community. And I have run the IDE Demo on Windows 7, 8 and 10. All with the same results.
To reproduce the problem:
- Launch IDE Demo.
- Edit Unit1 to match the code below.
- Click on the Run TToolbutton.
Once the script is running you will see that the Run button is not disabled and the Pause and Script Rest buttons are not Enabled.
But if you click on any of the menubar item, except About, while the script is running. This causes the UI to be updated. For some reason clicking on the About menubar item, does not do this.
After doing some research, I think I know that is causing this problem to happen. The TActionList.OnUpdate event only "Occurs when the application is idle so that the action list can update a specific action in the list."
It seems that for some reason, the Scripter Engine is allowing the application to become idle long enough for the ActionList.OnUpdate to be executed.
Test Code for Unit1:
uses
Classes, Graphics, Controls, Forms, Dialogs,
SysUtils, Unit2;
var
MainForm: TForm2;
i;
begin
Application.ProcessMessages;
MainForm := TForm2.Create(Application);
try
MainForm.Show;
for i := 1 to 60 do
begin
Application.ProcessMessages;
Sleep(100);
end;
finally
MainForm.FreeOnRelease;
end;
end;