Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
JRL
- Automation Wizard
- Posts: 3532
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed Apr 30, 2014 4:01 pm
Am I doing something wrong? CloseDialog> seems to have stopped working. I had to make a change to a script I wrote and compiled in 2010. After compiling the script today the dialog failed to close when it should have. I wrote this little script to test the function and CloseDialog> does not seem to close dialogs. The function works in the editor but not outside the editor or when compiled.
Macro Scheduler version 14.1.03. Tested on WinXP and Win7 both with latest updates.
Thanks for listening.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 536
Top = 307
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 82
ClientWidth = 125
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object MSButton1: tMSButton
Left = 25
Top = 23
Width = 75
Height = 25
Caption = 'Close'
TabOrder = 8
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,MSButton1,OnClick,srtClose
Show>Dialog1,
SRT>srtClose
CloseDialog>Dialog1
Wait>3
Exit>
END>srtClose
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Wed Apr 30, 2014 4:15 pm
Strange, works for me:
http://screencast-o-matic.com/watch/c2fvDonwus
However, you'd normally not need to use CloseDialog to close a modal dialog - just set the modal result of the button. But you know that. loseDialog would normally only be used to close another dialog or to close a non-modal dialog ....
-
JRL
- Automation Wizard
- Posts: 3532
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed Apr 30, 2014 4:20 pm
Yes it does work in the editor. Try it outside the editor and see if it still works.
I haven't used the function for a while but this particular script is long and I'd rather not have to rewrite it. It doesn't close on a button click per se. That was just how I wrote this sample.
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Wed Apr 30, 2014 4:36 pm
It works as it should. It closes after a 3 second delay. What's happening is that it can't close until the event handler has finished. Take the 3 second delay out and it works fine.
Why the difference? In order to debug scripts with modal messages and modal dialogs when in the editor such things aren't actually modal. If they were you wouldn't be able to interact with the editor - press F8 - stop the script etc. So during debug we kind of simulate modality. This does make a few subtle differences.
Outside of the editor your script makes a properly modal dialog and nothing can happen until it has finished executing and with a 3 second delay inside the event handler this means the event handler takes an extra 3 seconds to complete.