Scripts Stand Still on Dialog Title Bar Click

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Scripts Stand Still on Dialog Title Bar Click

Post by JRL » Mon Nov 21, 2011 10:28 pm

I've been meaning to ask this question for a long time.

Why does a script that contains a dialog, stop processing while the dialog is being moved?

To demonstrate, run the following script and notice the dialog label increments every second. Click on the dialog title bar and drag the dialog around or even hold it in place for a while. When you release the mouse button the numbers begin to increment again but they did not increment while the dialog was being moved. This indicates that moving the dialog pauses the script.

If you bump up the wait value from 1 to 5 you will see that the individual functions don't stop. With Wait at 5, clicking the title bar a brief moment after the label has incremented then holding it for more than five seconds will produce an increment immediately upon release of the mouse button. If the wait function had halted, one would expect to have to wait for something close to 5 seconds for the label increment.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  object Label1: TLabel
  end
  object MSButton1: tMSButton
    Left = 156
    Top = 126
    Width = 75
    Caption = 'Close'
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Quit
AddDialogHandler>Dialog1,msButton1,OnClick,Quit

Show>Dialog1

SRT>Quit
  Exit>0
END>Quit

Let>kk=0
Label>Loop
  Add>kk,1
  SetDialogProperty>Dialog1,Label1,Caption,kk
  Wait>1
Goto>Loop

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts