Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc selected_student_form { row } {
- set splitted_row [ split $row ";" ]
- set student_id [string trim [lindex $splitted_row 0] ]
- set student_name [string trim [lindex $splitted_row 1] ]
- set student_address [string trim [lindex $splitted_row 2] ]
- set student_telephone [string trim [lindex $splitted_row 3] ]
- set student_dob [string trim [lindex $splitted_row 4] ]
- toplevel .top_$student_id
- wm resizable .top_$student_id 0 0
- wm title .top_$student_id "Editing Student Number: $student_id"
- wm geometry .top_$student_id 400x300
- label .top_$student_id.student_id_lab -text "Student ID:" -anchor w
- entry .top_$student_id.student_id_ent ;#-state readonly
- .top_$student_id.student_id_ent delete 0 end
- .top_$student_id.student_id_ent insert 0 $student_id
- .top_$student_id.student_id_ent configure -state readonly
- label .top_$student_id.student_name_lab -text "Student Name:" -anchor w
- entry .top_$student_id.student_name_ent
- .top_$student_id.student_name_ent delete 0 end
- .top_$student_id.student_name_ent insert 0 $student_name
- bind .top_$student_id.student_name_ent <<MyEnter>> { focus .student_address_ent }
- label .top_$student_id.student_address_lab -text "Student address:" -anchor w
- entry .top_$student_id.student_address_ent -text "$student_address"
- bind .top_$student_id.student_address_ent <<MyEnter>> { focus .student_telephone_ent }
- .top_$student_id.student_address_ent delete 0 end
- .top_$student_id.student_address_ent insert 0 $student_address
- label .top_$student_id.student_telephone_lab -text "Student telephone:" -anchor w
- entry .top_$student_id.student_telephone_ent -text "$student_telephone"
- .top_$student_id.student_telephone_ent delete 0 end
- .top_$student_id.student_telephone_ent insert 0 $student_telephone
- label .top_$student_id.student_dob_lab -text "Date of birth:" -anchor w
- #breaking the $student_dob to its day, month, and year parts
- set dob_parts [ split $student_dob "-"]
- set dob_part_year [lindex $dob_parts 0 ]
- set dob_part_month [lindex $dob_parts 1 ]
- set dob_part_day [lindex $dob_parts 2 ]
- 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"
- 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"
- set current_year [clock format [clock seconds] -format %Y]
- tk_optionMenu .top_$student_id.student_dob_year dob_year_top "$dob_part_year"
- for {set i [expr $current_year -1 ] } { $i>=([expr $current_year -40]) } { incr i -1 } {
- .top_$student_id.student_dob_year.menu add radiobutton -label $i -variable dob_year_top
- }
- #date of birth will be taken thru globals in update_student{}
- button .top_$student_id.update_student_but -text "Update Student" -command {
- ### THIS IS WHERE i cannot PASS THE VALUE $student_id TO THIS BLOCK IN THE FOLLOWING LINE ###
- #//#### ###\\#
- 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]
- #//#### ###\\#
- }
Add Comment
Please, Sign In to add comment