Next | Prev | Up | Top | Contents | Index

Simple Message Dialogs

The simplest dialogs are message boxes. Tm defines five message dialogs with an icon, one without an icon, plus a simple prompt dialog. Table 4-57 lists the simple dialogs:

Informational Dialog Boxes
Widget NameIcon or Use
xmErrorDialogError (circle-backslash) icon
xmInformationDialogInformation (i) icon
xmQuestionDialogQuestion (?) icon
xmWarningDialogWarning (!) icon
xmWorkingDialogWorking (hourglass) icon
xmMessageDialogMessage box without icon
xmPromptDialogSimple prompt selection box

This example creates a menu that allows you to bring up each of the simple message dialogs listed above:

#! /usr/sgitcl/bin/moat 
xtAppInitialize
xmMainWindow .top managed
xmMenuBar .top.bar managed
xmCascadeButton .top.bar.File managed
xmCascadeButton .top.bar.Dialog managed
xmPulldownMenu  .FileMenu
xmPulldownMenu  .DialogMenu
xmLabel .top.msg managed -labelString {\n
    To see different types of dialog boxes, \n
    choose items from the Dialog menu. \n
}
.top.bar.File setValues -subMenuId .FileMenu
xmPushButton .FileMenu.Quit managed
.FileMenu.Quit activateCallback {exit 0}
.top.bar.Dialog setValues -subMenuId .DialogMenu
foreach b {Error Information Question Warning Working Message Prompt} {
    xmPushButton .DialogMenu.$b managed
    xm${b}Dialog .$b
    .$b.Cancel unmanageChild
    .$b.Help   unmanageChild
    .$b.OK     activateCallback {.$b unmanageChild}
}
.DialogMenu.Error       activateCallback {popup Error}
.DialogMenu.Information activateCallback {popup Information}
.DialogMenu.Question    activateCallback {popup Question}
.DialogMenu.Warning     activateCallback {popup Warning}
.DialogMenu.Working     activateCallback {popup Working}
.DialogMenu.Message     activateCallback {popup Message}
.DialogMenu.Prompt      activateCallback {popup Prompt}

# callback procedure
proc popup {type} {
    .$type setValues -messageString "This is an xm${type}Dialog"
    .$type manageChild
}

. realizeWidget
. mainLoop

Next | Prev | Up | Top | Contents | Index