Guest User

Untitled

a guest
Apr 19th, 2018
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 3.26 KB | None | 0 0
  1. proc selected_student_form { row } {
  2.  
  3.   set splitted_row [ split $row ";" ]
  4.   set student_id [string trim [lindex $splitted_row 0] ]
  5.   set student_name [string trim [lindex $splitted_row 1] ]
  6.   set student_address [string trim [lindex $splitted_row 2] ]
  7.   set student_telephone [string trim [lindex $splitted_row 3] ]
  8.   set student_dob [string trim [lindex $splitted_row 4] ]
  9.  
  10.   toplevel .top_$student_id
  11.  
  12.   wm resizable .top_$student_id 0 0
  13.   wm title .top_$student_id "Editing Student Number: $student_id"
  14.   wm geometry .top_$student_id  400x300
  15.  
  16.   label .top_$student_id.student_id_lab -text "Student ID:" -anchor w
  17.   entry .top_$student_id.student_id_ent ;#-state readonly
  18.     .top_$student_id.student_id_ent  delete 0 end
  19.     .top_$student_id.student_id_ent insert 0 $student_id
  20.     .top_$student_id.student_id_ent configure -state readonly
  21.  
  22.   label .top_$student_id.student_name_lab -text "Student Name:" -anchor w
  23.   entry .top_$student_id.student_name_ent
  24.     .top_$student_id.student_name_ent  delete 0 end
  25.     .top_$student_id.student_name_ent insert 0 $student_name
  26.  
  27.   bind  .top_$student_id.student_name_ent <<MyEnter>> { focus .student_address_ent }
  28.  
  29.   label .top_$student_id.student_address_lab -text "Student address:" -anchor w
  30.   entry .top_$student_id.student_address_ent -text "$student_address"
  31.   bind  .top_$student_id.student_address_ent <<MyEnter>> { focus .student_telephone_ent }
  32.     .top_$student_id.student_address_ent  delete 0 end
  33.     .top_$student_id.student_address_ent insert 0 $student_address
  34.  
  35.   label .top_$student_id.student_telephone_lab -text "Student telephone:" -anchor w
  36.   entry .top_$student_id.student_telephone_ent -text "$student_telephone"
  37.     .top_$student_id.student_telephone_ent  delete 0 end
  38.     .top_$student_id.student_telephone_ent insert 0 $student_telephone
  39.  
  40.   label .top_$student_id.student_dob_lab -text "Date of birth:" -anchor w
  41.   #breaking the $student_dob to its day, month, and year parts
  42.   set dob_parts [ split $student_dob "-"]
  43.  
  44.   set dob_part_year     [lindex $dob_parts 0 ]
  45.   set dob_part_month    [lindex $dob_parts 1 ]
  46.   set dob_part_day  [lindex $dob_parts 2 ]
  47.  
  48.   tk_optionMenu .top_$student_id.student_dob_day dob_day_top "$dob_part_day" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31"
  49.   tk_optionMenu .top_$student_id.student_dob_month dob_month_top "$dob_part_month" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12"
  50.  
  51.   set current_year [clock format [clock seconds] -format %Y]
  52.   tk_optionMenu .top_$student_id.student_dob_year dob_year_top "$dob_part_year"
  53.   for {set i [expr $current_year -1 ] } { $i>=([expr $current_year -40]) } { incr i -1 } {
  54.   .top_$student_id.student_dob_year.menu  add radiobutton -label $i -variable dob_year_top
  55.   }
  56.  
  57.   #date of birth will be taken thru globals in update_student{}
  58.   button .top_$student_id.update_student_but -text "Update Student" -command {
  59.  
  60.    ### THIS IS WHERE i cannot PASS THE VALUE $student_id TO THIS BLOCK IN THE FOLLOWING LINE ###
  61.                     #//####     ###\\#
  62.                          
  63.     update_student [ .top_$student_id.student_id_ent get] [ .top_$student_id.student_name_ent get] [ .top_$student_id.student_address_ent get] [ .top_$student_id.student_telephone_ent get]  
  64.  
  65.                     #//####     ###\\#
  66. }
Add Comment
Please, Sign In to add comment