WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: rw_baker on January 14, 2017, 10:20:12 AM

Title: Dialog initiation error
Post by: rw_baker on January 14, 2017, 10:20:12 AM
Very infrequently(for maybe the last month or so) scripts that initiate a Dialog come up with the attached error.  I immediately execute that script again and it runs through to completion without error (dialog is created without error).  This is such a minor inconvenience that I didn't log when it first came up.  I know of no conditions that make it happen.
I wonder if anyone else has noticed this error?  The scripts that contain the Dialogs have not been altered.

Running 2017A.

RW Baker
Title: Re: Dialog initiation error
Post by: td on January 14, 2017, 01:20:10 PM
There are many reasons why you might get the error but since we know nothing about the dialog template or possible associated callback function, it is impossible to state what is causing the error in this particular case.
Title: Re: Dialog initiation error
Post by: td on January 15, 2017, 08:44:39 AM
There are three areas you might want to look at to start your attempt to discover the cause of this error:


Again, this is far from a complete list of possibilities.
Title: Re: Dialog initiation error
Post by: rw_baker on January 16, 2017, 05:45:00 PM
I appreciate your continued support!

Sunday AM I made an alteration in the script, that I have shown in the attachment.  Since then, there has not been an error.  Errors happen very infrequently, so I don't know if the alteration has helped.

RW Baker
Title: Re: Dialog initiation error
Post by: td on January 17, 2017, 06:56:59 AM
Normally, WinBatch will automatically disable the caller dialog when you display a second dialog from the callback of the caller.  However, since you are starting a new process for your second it dialog will not happen so you need to disable a dialog before displaying a second dialog from a user defined callback.

It would be much simpler to display your second dialog by calling the 'Dialog' function directly from the callback of your first dialog.  But perhaps you have a legitimate  reason for not doing so.
Title: Re: Dialog initiation error
Post by: rw_baker on January 17, 2017, 07:46:36 AM
I think I do have a "legitimate reason", but I will take another look to confirm.

Thanks,

RW Baker
Title: Re: Dialog initiation error
Post by: td on January 17, 2017, 09:00:06 AM
Generally, it is best to put your templates into separate files and then just #include them into your script file.  And yes you can still have the 'Dialog' function call in your template file.  You just have to set the second optional function parameter to 0.
Title: Re: Dialog initiation error
Post by: rw_baker on January 17, 2017, 02:31:53 PM
Fine, I have replaced:
call("F:\WBT\Programs\WDLs\calendar select.WDL","")
with:
#include "F:\WBT\Programs\WDLs\calendar select.WDL"
When you say:
"And yes you can still have the 'Dialog' function call in your template file.  You just have to set the second optional function parameter to 0."
Do you mean if I did use the "call" that it should be?
call("F:\WBT\Programs\WDLs\calendar select.WDL",0)      ;<- I used "" instead 0.
Does the 0 convey some special meaning to "call"?  I could have missed it, but I do not see any documentation in "call" for this?
Thanks,
RW Baker
Title: Re: Dialog initiation error
Post by: td on January 17, 2017, 04:47:23 PM
You display a dialog in your script by using the Dialog function.  The WIL Dialog Editor uses the Dialog function to load the dialog template into the editor.   You place in #include statement in your script some place before you call the Dialog function with your included dialog template's name.  The included template file also has a Dialog statement in it but it is not executed by WinBatch because you (or Dialog Editor at your behest) has placed a 0 in the optional second parameter of that Dialog statement. This allows you to still edit the template in the WIL Dialog Editor without having to worry about the dialog display where or when you don't want it to.    So instead of using a "Call" statement in your main script to displaying your dialog, you use a Dialog statement without a second parameter set to 0.

Title: Re: Dialog initiation error
Post by: rw_baker on January 17, 2017, 05:36:37 PM
Finally...I get it now.
Thanks,
RW Baker