Finding a record

Locating a record is a common procedure in most data-driven applications. In our application, we have limited this to locating the first occurrence by last name. To accomplish this, we will create a new toplevel window to request input and trigger procedures that interact with our main window.

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 findRecord { } { set strLast "" toplevel .find frame .find.f -borderwidth 1 -relief solid -padx 10 -pady 10 entry .find.f.e -borderwidth 5 -relief solid button .find.f.ok -text "Find" -command {set strLast [.find.f.e \ get]; lookup $strLast} button ...

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.