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