www.gibmonks.com

  Previous section   Next section

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Part V.  Tk Details


Chapter 36. Focus, Grabs, and Dialogs

Dialog boxes are a standard part of any user interface. Several dialog boxes are built into Tk. This chapter also describes how to build dialogs from scratch, which involves keyboard focus and grabs. Input focus directs keyboard events to different widgets. The grab mechanism lets a widget capture the input focus. This chapter describes the focus, grab, tk_dialog, and tkwait commands. Tk 4.2 adds tk_getOpenFile, tk_getSaveFile, tk_chooseColor, and tk_messageBox.

Dialog boxes are a common feature in a user interface. The application needs some user response before it can continue. A dialog box displays some information and some controls, and the user must interact with it before the application can continue. To implement this, the application grabs the input focus so that the user can only interact with the dialog box. Tk has several built-in dialog boxes, including standard dialogs for finding files and selecting colors. A standard dialog has the same Tcl interface on all platforms, but it is implemented with platform-specific library routines to provide native look and feel. This chapter describes the dialogs built into Tk and then goes into the details of focus and grabs.


      Previous section   Next section
    Top