Deleting a record
Adding records is complete as is navigating between them. So now we need the ability to remove records from both the active dictionary and the data file. This is accomplished with a single procedure. Care must be taken to address the fact that a user may click on Delete when no records exist and to handle the condition where the user has deleted all records.
How to do it…
In the address book file, enter the following text at the location defined in our main page for procedures, as defined within the comments after the previous section's procedures.
proc deleteRecord {} { global addressFile global addressInfo global currentRecord global recordCount if {$recordCount > 0} { set myTitle "Confirm Request" set myMessage "Select OK to delete the current record" set response [tk_messageBox -message $myMessage \ -title myTitle \ -type okcancel \ -icon warning] if {$response == "ok"} { puts "DELETE COUNT: $recordCount CURRENT: $currentRecord" set tempDict [dict remove $addressInfo...