Yes, replace your current Dlg.Show();
line with something this:
Dlg.Create(); // Dialog is not visible yet.
// ... Set up controls as needed
Dlg.Control('Quality').value = 3;
// ...
// Dlg.Show(); needed here before Opus 12.22
Dlg.RunDlg(); // Dialog becomes visible. Won't return until dialog is closed.