next up previous contents index
Next: 4. Extending the VendorShell Up: 4. Diverting User Input Previous: 4. Primary Application Modal   Contents   Index

3. Creating Dialog Shells the Right Way

XtCreatePopupShellXtCreateWidgetThere are two major ways of creating dialog shells:
\begin{itemlist}
\item Either using \code{XtCreatePopupShell()} or one of the
\c...
...ets -- which must be distinguished from the
list of popup shells.
\end{itemlist}

Although not recommended, XtCreateWidget() is widely used for creating dialog shells or shells in general (shame on me, too. Where's the sack and the ash?). Maybe the most prominent reason for this is that it makes widget creation more uniform. At the first look there seems to be no reason why to use XtCreatePopupShell() anyway. But M*TIF needs to know for its grab layer whether a shell widget serves as an ordinary top level shell (and thus has no modality) or as a dialog shell. In the latter case the XmNdialogStyle resource of a BulletinBoard-derived child of a dialog shell controls the dialog modality and eventually the grabs used.

The only way currently known to distinguish ordinary shells from shells working as popup dialogs is to check whether the shell is registered with the parent's list of popup shells. But this will fail miserably if the dialog shell was created using XtCreateWidget() instead of XtCreatePopupShell(). In that case the dialog shell first sets an unnecessary non-modal grab as soon as the shell is realized. Finally, when popping up the dialog, the LTShellPopupCallback callback sets the real (modal or non-modal) grab. Fortunately the first and unnecessary non-modal grab doesn't hurt very much - it just pollutes M*TIF's grab list. But the user won't notice that anyway.


next up previous contents index
Next: 4. Extending the VendorShell Up: 4. Diverting User Input Previous: 4. Primary Application Modal   Contents   Index
Danny Backx
2000-12-13