dialog.Initialize(mainObj.Root)
dialog.Title = "Connection Options"
#if b4j
btnGetOctoKey.Visible = False
#end if
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 400dip, 320dip)
p.LoadLayout("dlgPrinterSetup")
#if b4a
dialog.PutAtTop = True 'put the dialog at the top of the screen
#end if
Try
dialog.SetButtonState(xui.DialogResponse_Positive,False) '--- this tosses the error ***********************
Catch
Log(LastException) ' see below for exception
End Try
Wait For (dialog.ShowCustom(p, "OK", "", "Cancel")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive And ValidConnection Then
Save_settings
End If