your did -fu $dname is missing a dialog id number
When you use the -x flag you only need to name the dialog once, and in fact, the way you have that at the moment you can just use did -x $dname
The dialog -ma test test is fine, except what if the dialog is already open? You'll get an (ugly imo) error message.Check to see if the dialog is open using an $iif
alias _test dialog $iif($dialog(test),-x,-ma test) test