3 # This demonstration script creates message boxes of various type
5 # RCS: @(#) $Id: msgbox.tcl,v 1.2 1998/09/14 18:23:29 stanton Exp $
7 if {![info exists widgetDemo
]} {
8 error "This script should be run from the \"widget\" demo."
14 wm title
$w "Message Box Demonstration"
15 wm iconname
$w "messagebox"
18 label $w.msg
-font $font -wraplength 4i
-justify left
-text "Choose the icon and type option of the message box. Then press the \"Message Box\" button to see the message box."
22 pack $w.buttons
-side bottom
-fill x
-pady 2m
23 button $w.buttons.dismiss
-text Dismiss
-command "destroy $w"
24 button $w.buttons.code
-text "See Code" -command "showCode $w"
25 button $w.buttons.vars
-text "Message Box" \
26 -command "showMessageBox $w"
27 pack $w.buttons.dismiss
$w.buttons.code
$w.buttons.vars
-side left
-expand 1
31 pack $w.left
$w.right
-side left
-expand yes
-fill y
-pady .5c
-padx .5c
33 label $w.left.
label -text "Icon"
34 frame $w.left.sep
-relief ridge
-bd 1 -height 2
35 pack $w.left.
label -side top
36 pack $w.left.sep
-side top
-fill x
-expand no
39 foreach i
{error info question warning
} {
40 radiobutton $w.left.b
$i -text $i -variable msgboxIcon
\
41 -relief flat
-value $i -width 16 -anchor w
42 pack $w.left.b
$i -side top
-pady 2 -anchor w
-fill x
45 label $w.right.
label -text "Type"
46 frame $w.right.sep
-relief ridge
-bd 1 -height 2
47 pack $w.right.
label -side top
48 pack $w.right.sep
-side top
-fill x
-expand no
51 foreach t
{abortretryignore ok okcancel retrycancel yesno yesnocancel
} {
52 radiobutton $w.right.
$t -text $t -variable msgboxType
\
53 -relief flat
-value $t -width 16 -anchor w
54 pack $w.right.
$t -side top
-pady 2 -anchor w
-fill x
57 proc showMessageBox
{w
} {
58 global msgboxIcon msgboxType
59 set button [tk_messageBox -icon $msgboxIcon -type $msgboxType \
60 -title Message
-parent $w\
61 -message "This is a \"$msgboxType\" type messagebox with the \"$msgboxIcon\" icon"]
63 tk_messageBox -icon info -message "You have selected \"$button\"" -type ok
\