I have a little issue with a dialog. I always get an "unexpected method call" error if and only if I close the dialog using the X-button in the title bar. Closing the dialog with any close-button doesn't show that message. Here's the code that throws the error message:
If dlg.Control("combo1").value = 2 Then
dlg.Control("edit2").visible = True
dlg.Control("edit2").SelectRange 0,-1
If colIndex = False And Script.config.IndexColumn = False Then
cmd.RunCommand("Set COLUMNSADD=index(0)")
End If
Else
dlg.Control("edit2").visible = False
If colIndex = False And Script.config.IndexColumn = False Then
cmd.RunCommand("Set COLUMNSREMOVE=index")
End If
End IfDepending on the state of combo1 the error refers to line 2 or 8. I tried to enclose the whole thing in an "If dlg.result = 0 Then" clause but this didn't work because hide/show the Column/Control didn't work correctly.
How can I avoid that error?
I know and didn't want to do that but it seems my Script wants to hide the controls when I close it with the X-Button. What I tried was an If-clause If Not dlg.result = 0 Then (I forgot the Not in my last post). Not a big deal but I don't like error messages.
I'm now getting this error message for the very first line of the dialog message loop. The message doesn't appear when closing the dialog with a close button that does If dlg.result =0 Then. I put the line If msg.result = 0 Then exit do right after the line Set Msg = Dlg.GetMsg() but it didn't help. Closing the dialog with the X-button doesn't seem to output 0 to dialog/Msg so the message loop doesn't exit and the code after If dlg.result = 0 Then (clear some filters) isn't executed. I have to add On error resume next to avoid this but that's not a good solution.
Please have a look into this.