source bar.tcl

proc bar_detail {elem_num } {

toplevel .bar_detail -width 65m -height 75m
set bard .bar_detail
wm title $bard "Bar Setup"

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

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

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

    button $bard.ok \
        -text Ok -command {setup_bar $elem_num; destroy .bar_detail}
    button $bard.cancel \
        -text Cancel -command {destroy .bar_detail}


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

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

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


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

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

}


proc setup_bar { 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_detail $max_entry $min_entry $ave_entry $yrange_entry $rrange_entry
display_bar_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


}
