11-13-2012 01:55 AM
Hello All,
This is my first serious attempt at creating an SUD dialog box (modal). I did things according to the manual, but get the following error:
--------------------------- Dialog Editor (SUD) --------------------------- Error in <20121112_M1545_postexfacto_DDMcomp.SUD,Dlg1> (Line: 14,Column: 2): SUD event context: Dialog_EventInitialize(...) ... Objekt erforderlich: 'This.GetArgument()' --------------------------- OK ---------------------------
The underlying code is this:
Sub Dialog_EventInitialize(ByRef This) 'Created Event Handler Set parameterList = This.GetArgument() Call File1Input.RunInitialize Call File2Input.RunInitialize Call ResultFileInput.RunInitialize End Sub
It is the second line of the Sub that generates the error. I would be very grateful if you could tell me what I am doing wrong.
Solved! Go to Solution.
11-13-2012 02:19 AM
Hi Leo,
I assume that you didn't use the object "parameterList" as parameter in the command line which calls the dialog in your script.
call SUDDlgShow("DialogName", CurrentScriptPath & "SUDFileName", ObjectName)
Greetings
Walter
11-13-2012 03:09 AM
I did pass an argument, but it was an array (which did not work). I now created a class with three public properties, each of which should be returned by the dialog box.
Class M1545_TTRcomp_parameters Public file1Path, file2Path, resultFile End Class
The properties are set by filling three text fields in the dialog, which are read when the OK button is clicked:
Sub OK_EventClick(ByRef This) 'Created Event Handler parameterList.file1Path = File1Input.GetSelectedText parameterList.file2Path = File2Input.GetSelectedText parameterList.resultFile = ResultFileInput.GetSelectedText Call Dialog.OK End Sub
When I now call the dialog box and display each property, it shows that only the first contains anything:
Dim testObject Set testObject = New M1545_TTRcomp_parameters If SUDDlgShow("Dlg1","20121112_M1545_postexfacto_DDMcomp.SUD",testObject) = "IDOk" Then Call MsgBoxDisp("Success!") call MsgBoxDisp(testObject.file1Path) Call MsgBoxDisp(testObject.file2Path) Call MsgBoxDisp(testObject.resultFile) Else Call MsgBoxDisp("Failure.") End If
So obviously it works to some extent, but I am preventing all input to get through.
11-13-2012 03:36 AM
The problem has been solved; I used "GetSelectedText" to retrieve the contents of the text input boxes, instead of "Text". It works now; thank you for your help, Walter!