DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Canceling Dialog Box after a button is pushed

Solved!
Go to solution

The problem I have is I open the dialog box and push my button to call another script to run.  But if there is an error the error is hid behind the dialog box.  I would like to Call the dialog box, push button and then close my dialog box before the script runs.  Can that be done.

So far I have tried this and can get it to do what I want.

 

SubButton4_EventClick(ByRef This) 'Created Event Handler

CallUIAutoRefreshSet(0)

Call dialog.cancel

Callscriptinclude ("D:\_Calterm_Configuration_Files\Technical_Information\DIAdem_Scripts\Insite_DataLog_FileLoader.VBS")

CallUIAutoRefreshSet(1)

End Sub

0 Kudos
Message 1 of 6
(6,657 Views)

Hi J,

 

If you're willing to have the SUDialog close to unubstruct the view of a potential error dialog, then why not conditionally call the next script right after the SudDlgShow() command in the script that calls the SUDialog?  If the user closes the dialog with the Cancel action, you don't run the script, but if they close with the Ok action, you do-- like this:

 

Response = SudDlgShow("MyDialog", CurrentScriptPath & "MyDialogFile.SUD")
IF Response = "IDOk" THEN Call ScriptStart("MyScriptPath")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 6
(6,649 Views)
Let me try and explain more.... When diadem starts I autolaunch a sud dialog box. Which is kinda a menu to allow the user to run multiple scripts. Once the user chooses the script he wants to run I want the diAlog box to close and then run choosen script. I hope that helps. If u think what u have said will work just say so. Thanks!
0 Kudos
Message 3 of 6
(6,643 Views)
Solution
Accepted by topic author Jcheese

Hi J,

 

Which command are you using to launch your SUDialog?

 

SudDlgShow()

SudDlgCreate()

 

The code you posted was for  the Dialog.Cancel callback-- do you NOT want to close the SUDialog after all?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 6
(6,640 Views)

Brad,

 

I am using "Call SuddlgShow() once that dialog box opens, the user picks a button and that buttonstarts a script to load a set of data.  and the way it runs now the dialog box does not close until after the script runs successfully.  I want to change that so once the button is choosen the dialog box closes and then runs the choosen script.  Sorry for the confusion hope that makes more sense.

0 Kudos
Message 5 of 6
(6,628 Views)

Hi J,

 

In that case I revert back to my original suggestion.  If you want the script to be run after the dialog closes, why not run the script with ScriptStart or ScriptInclude in the next line of code after SudDlgShow()?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 6
(6,620 Views)