nestedDialog[] := Module[{tag = True},
Unprotect[DialogReturn];
DialogReturn[i_] /; tag :=
Internal`InheritedBlock[{System`FEDump`$DialogDone},
Unprotect[DialogReturn];
DialogReturn[j_] /; tag =.;
System`FEDump`$DialogDone /:
HoldPattern[System`FEDump`$DialogDone = True] = True;
DialogReturn[i];
Protect[DialogReturn];
System`FEDump`$DialogDone /:
HoldPattern[System`FEDump`$DialogDone = True] =.;
];
Protect[DialogReturn];
];
Use: just call nestedDialog[] before creating new nested dialogs. It makes sense to make the nested dialogs modal because the DialogInput won't return until as many DialogReturnshave been run as nestedDialog[]s have been run (plus one)
DialogInput@{Button["Click this", nestedDialog[];
CreateDialog["Close this", Modal -> True]],
DefaultButton[DialogReturn["alskjl"]]}
I tested this in Mathematica 8.0.4, W7x64.
Quoted from @AlbertRetey's comment. "I have now tested your code with Mathematica 6.0.2,7.0.1 and 8.0.4 on both Windows 7 and Linux (CentOS) and at least the simple example seems to work alright with any of them"