if {[namespace exists $t]} {namespace delete $t}
 }
 
+proc make_dialog {t w args} {
+       upvar $t top $w pfx this this
+       global use_ttk
+       uplevel [linsert $args 0 make_toplevel $t $w]
+       catch {wm attributes $top -type dialog}
+       pave_toplevel $pfx
+}
+
 proc make_toplevel {t w args} {
        upvar $t top $w pfx this this
 
                }
        }
 
-       if {[winfo ismapped .]} {
+       if {$::root_exists || [winfo ismapped .]} {
                regsub -all {::} $this {__} w
                set top .$w
                set pfx $top
                toplevel $top
+               set ::root_exists 1
        } else {
                set top .
                set pfx {}