source bar2.tcl

proc bar_detail2 {elem_num } {

toplevel .bar_detail2 -width 65m -height 75m
set bard2 .bar_detail2
wm title $bard2 "Bar Setup"

    label $bard2.bargraph_title \
        -foreground #0000f0 -height 0 -text {Bar Graph Detail}

    label $bard2.max_label \
        -height 0 -text Maximum
    label $bard2.min_label \
        -height 0 -text Minimum
    label $bard2.ave_label \
        -height 0 -text Average
    label $bard2.yrange_label \
        -height 0 -text "Yellow Range"
    label $bard2.rrange_label \
        -height 0 -text "Red Range"

    entry $bard2.max_entry \
        -background white -textvariable max_entry -width 78
    entry $bard2.min_entry \
        -background white -textvariable min_entry -width 78
    entry $bard2.ave_entry \
        -background white -textvariable ave_entry -width 78
    entry $bard2.yrange_entry \
        -background white -textvariable yrange_entry -width 78
    entry $bard2.rrange_entry \
        -background white -textvariable rrange_entry -width 78

    button $bard2.ok \
        -text Ok -command {setup_bar2 $elem_num; destroy .bar_detail2}
    button $bard2.cancel \
        -text Cancel -command {destroy .bar_detail2}


    ###################
    # SETTING GEOMETRY
    ###################

    place $bard2.bargraph_title \
        -x 15 -y 5 -anchor nw -bordermode ignore

    place $bard2.max_label \
        -x 15 -y 40 -anchor nw -bordermode ignore
    place $bard2.min_label \
        -x 15 -y 65 -anchor nw -bordermode ignore
    place $bard2.ave_label \
        -x 15 -y 90 -anchor nw -bordermode ignore
    place $bard2.yrange_label \
        -x 15 -y 115 -anchor nw -bordermode ignore
    place $bard2.rrange_label \
        -x 15 -y 140 -anchor nw -bordermode ignore


    place $bard2.max_entry \
        -x 100 -y 40 -width 78 -height 22 -anchor nw -bordermode ignore
    place $bard2.min_entry \
        -x 100 -y 65 -width 78 -height 22 -anchor nw -bordermode ignore
    place $bard2.ave_entry \
        -x 100 -y 90 -width 78 -height 22 -anchor nw -bordermode ignore
    place $bard2.yrange_entry \
        -x 100 -y 115 -width 78 -height 22 -anchor nw -bordermode ignore
    place $bard2.rrange_entry \
        -x 100 -y 140 -width 78 -height 22 -anchor nw -bordermode ignore

    place $bard2.ok \
        -x 30 -y 175 -anchor nw -bordermode ignore
    place $bard2.cancel \
        -x 80 -y 175 -anchor nw -bordermode ignore

}


proc setup_bar2 { elem_num } {

global min_entry
global max_entry
global ave_entry
global yrange_entry
global rrange_entry



if {$min_entry == "" }  { set min_entry 0 }
if {$max_entry == "" }  { set max_entry 5 }
if {$ave_entry == "" }  { set ave_entry 2.5 }
if {$yrange_entry == "" }  { set yrange_entry 1 }
if {$rrange_entry == "" }  { set rrange_entry 2 }

# Set all the min and max details
set_detail2 $max_entry $min_entry $ave_entry $yrange_entry $rrange_entry
display_bar2_or_not 1 $elem_num


# set it to c++ database
setting_bar_detail $elem_num $max_entry $min_entry $ave_entry $yrange_entry $rrange_entry

}
