# $Header: /home/cvsroot/tcldb/ucodb/Tlib/mkDialog,v 1.3 1998/10/26 21:17:52 de Exp $
# tcl procs saved on Sun Sep 03 16:18:51 PDT 1995

proc mkDialog {w msgArgs args} {


  set win_title $w
  regsub -all {_} $win_title " " win_title
  set w [translit A-Z a-z $w]

    catch {destroy $w}
    toplevel $w -class Dialog
    wm title $w [string range $win_title 1 end]
    wm geom $w "+200+200"

    # Create two frames in the main window. The top frame will hold the
    # one above the other, with any extra vertical space split between
    # them.

    frame $w.top -relief raised -border 1 -background antiquewhite
    frame $w.bot -relief raised -border 1 -background antiquewhite
    pack $w.top -side top -fill both -expand true 
    pack $w.bot -side top -fill both -expand true
    
    # Create the message widget and arrange for it to be centered in the
    # top frame.
    
    set font [getFont $w mediumtim]
    eval message $w.top.msg -justify center 	    -font $font $msgArgs -background antiquewhite
    pack $w.top.msg -side top -expand true -ipadx 5 -ipady 5
    
    # the dialog.

    if {[llength $args] > 0} {
	set arg [lindex $args 0]
	frame $w.bot.0 -relief sunken -border 1 -background antiquewhite
	pack $w.bot.0 -side left -expand true -ipadx 5 -ipady 5
	button $w.bot.0.button -text [lindex $arg 0] 		-command "[lindex $arg 1]; destroy $w" -padx 0 -pady 0 -background lavender -activebackground lavender -activeforeground magenta2
	pack $w.bot.0.button -expand true -ipadx 5 -ipady 5
	bind $w <Return> "[lindex $arg 1]; destroy $w; break"
	focus $w

	set i 1
	foreach arg [lrange $args 1 end] {
	    button $w.bot.$i -text [lindex $arg 0] 		    -command "[lindex $arg 1]; destroy $w" -padx 0 -pady 0 -background white -foreground red -activebackground black -activeforeground yellow
	    pack $w.bot.$i -side left -expand true 
	    incr i 
	}
    }
}

