
# # **************************** APSRepack ******************************
# proc APSRepack {widget args} {
#     eval pack $widget [pack info $widget] $args
# }
# **************************** APSAlertBox1 ***************************
proc APSAlertBox1 {widget args} {
# Runs APSAlertBox with a unique name if -unique 1 is specified
# Configures the color with -bg and -fg
# Returns the name in case you need it later

# Parse arguments
    set unique 0
    set bg Red
    set fg White
    set title "Error"
    APSParseArguments {unique fg bg}

# Define unique number
    if {$unique} {
	set w $widget[APSUniqueNumber]
    } else {
	set w $widget
    }
    
# Run APSAlertBox
    eval APSAlertBox $w $args

# Configure it
    destroy $w.label
    wm title $w $title
    $w configure -bg $bg
    $w.buttonRow configure -bg $bg
    $w.buttonRow.ok.button configure -fg $fg -bg $bg
    $w.msg configure -fg $fg -bg $bg
# Return the widget name used
    return $w
}
# **************************** APSErrorDialog *************************
proc APSErrorDialog {widget args} {

# Parse arguments
    set unique 0
    set errorMessage "No message"
    set title "Error"
    APSParseArguments {unique title errorMessage}

# Define unique number
    if {$unique} {
	set w $widget[APSUniqueNumber]
    } else {
	set w $widget
    }
    
    toplevel $w -background Red
    wm title $w $title
    label $w.msg -justify left -wraplength 500 -relief raised -bd 2 \
      -text $errorMessage -padx 5 -pady 5 -background Red -foreground White
    pack $w.msg -side top
    frame $w.frame -relief raised -bd 2 -background Red
    pack $w.frame -side top -fill x
    button $w.frame.ok -text OK -command "destroy $w" \
      -background Red -foreground White -highlightbackground Red
    pack $w.frame.ok -side bottom -pady 5
    update idletasks
}
# **************************** APSExec1Log ****************************
proc APSExec1Log {widget args} {
# Runs APSExecLog with a unique name if -unique 1 is specified
# Configures the size with -width and -height
# Returns the name in case you need it later

# Parse arguments
    set unique 0
    APSParseArguments {unique}

# Define unique number
    if {$unique} {
	set w $widget[APSUniqueNumber]
    } else {
	set w $widget
    }
    
# Run APSExecLog
    eval APSExecLog $w $args

# Return the widget name used
    return $w
}
# **************************** APSResetDefaultFont ********************
proc APSResetDefaultFont {args} {

    if {[llength $args] == 0} {
	set font -adobe-courier-bold-r-normal-*-*-120-75-75-*-*-*-*
    } else {
	set font [lindex $args 0]
    }
    
# Run APSStandardSetup so it will autoload
    auto_load APSStandardSetup
# Fix APSStandardSetup to redefine the font after it finishes
    rename APSStandardSetup APSStandardSetup0
    proc APSStandardSetup {args} "
	APSStandardSetup0
	option add *font  $font
    "
}
