#function that generates the dialog box
proc dialog {title text} {
    
  #name the dialog box 
  toplevel .d -class Dialog
  wm title .d $title
  wm iconname .d Dialog
  #wm minsize .d 90 90
  #wm maxsize .d 100 100
  
  #create the lop-level window and divide it into top and bottom parts
  frame .d.top -relief raised -bd 1
  frame .d.bot -relief raised -bd 1
  pack  .d.top .d.bot -fill both
  
  #fill the top part with a message
  message .d.top.msg -width 2i -text $text
  pack .d.top.msg -fill both -pady 2 -padx 2 -expand 1
  
  #fill the bottom part with buttons or options
  
    #display the old value to be changed
    frame .d.bot.old
    pack .d.bot.old
    
    label .d.bot.old.value -text "Old Value:"
    label .d.bot.old.valuename -textvariable OldValue -width 15
    pack .d.bot.old.value .d.bot.old.valuename -side left -fill x
    
    #display the box to change the new value
    frame .d.bot.new
    pack .d.bot.new
    
    label .d.bot.new.value -text "Enter New Value:"
    entry .d.bot.new.valuename -width 15 -textvariable NewValue
    pack .d.bot.new.value .d.bot.new.valuename -side left -fill x
    
    #display the option buttons in the dialog box
    frame .d.bot.but
    pack .d.bot.but
    
    button .d.bot.but.cancel -text "Cancel" -command {ok}
    button .d.bot.but.ok -text "Ok" -command {double}
    pack .d.bot.but.cancel .d.bot.but.ok -side left -fill x -padx 2 -pady 2
  
}

#function to remove the dialog box
proc ok {} {
  global NewValue
  set NewValue ""
    destroy .d
}
    
#function that changes the double value and stores in temporary memory
proc double {} {
  global NewValue ArrayName point
  
  set Arr $ArrayName
  set len [llength $Arr]
  set arglist [lrange $Arr 1 $len]
  set Arr "$arglist $point $NewValue"
  eval pdbSetDouble $Arr
  ok
  regsub -all " " $ArrayName {\&} Arr2 
  __pdbFillList $Arr2
}

