
# **************************** APSMakeToplevel *************************
proc APSMakeToplevel {w args} {
# w         toplevel widget
# -title    toplevel window title
# -command  command to make the window contents
#             first argument of command must be the parent widget
#             remaining arguments are passed as args
    global apsContextHelp
    set title ""
    set command ""
    set contextHelp ""
    APSParseArguments {title command contextHelp}

    if {$contextHelp != ""} {
	set apsContextHelp($w) $contextHelp
    }

    if {![winfo exists $w]} {
        toplevel $w
        wm title $w $title

	eval $command $w $args

	frame $w.framelast
	pack $w.framelast -side top

	APSButton .remove -parent $w -text Remove -command "destroy $w" \
	-contextHelp "Removes this dialog box."
	pack $w.remove -in $w.framelast -side left -padx 5 -pady 5 -fill both
    } else {
        raise $w
    }
}
