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 ...

Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.