DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Changes to checkbox not recognized

I am attempting to write a code that will load a .dat file into DIAdem, then save that file as an .xls (excel) file.  My problem is that the checkboxes do not seem to be recognized in further lines of the code.  The BenTest.sud file simply brings up a dialog box with two checkboxes (both initially unchecked).  The green portion works fine, the error occurs in the red line, and the error message is shown below in red.  The red line is simply a troubleshooting line of code to determine the boolean value of the checkbox.
 
Call DataLoadHdFile("C:\Data\Testing\BensTest\processed 1_COMPASS NCAP 060816_DIAdemHeader_BINARY.dat")
Call DataLoad("C:\Data\Testing\BensTest\processed 1_COMPASS NCAP 060816_DIAdemHeader_BINARY.dat")
 
Call SUDDlgShow("BensDialog", "C:\Data_Processing_DiaDem10\Aut\BenTest.sud")
MsgBox("CVSCheckBox:  " & ExcelCheckBox.Value)
 
if ExcelCheckBox_ = 1 then
  Call ExcelExport(, , 1)
else if CSVCheckBox_ = true then
  MsgBox("CSV checkbox selected.")
else
  MsgBox("No Conversions Selected.")
end if
end if
 
Error Message
Object Required: 'ExcelCheckBox'
0 Kudos
Message 1 of 3
(3,091 Views)
Hello CrshTstr!

You have to know that the DIAdem and the SUD Scripts are completly separated. The DIAdem script will not know any of your SUD controls (BTW: the controls will be destroyed after the SudDlgShow) !

The solution is to copy the values to DIAdem variables in the SUD Dialog Terminate event or to connect the control with a variable . For Example:
Sub Dialog_EventTerminate()
Dim This : Set This = Dialog
L1 = ExcelCheckBox.Value
End Sub
 
Than you can use L1 in your DIAdem script. It is a good practice to use the DlgState variable to recognize if the user had canceled the dialog.

Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 3
(3,083 Views)
Thank you.  I know understand the disconnect between the dialog box code and my main DIAdem code.
0 Kudos
Message 3 of 3
(3,080 Views)