TIP #204: Virtual Events for Keyboard Traversal


TIP:204
Title:Virtual Events for Keyboard Traversal
Version:$Revision: 1.5 $
Author:Joe English <jenglish at users dot sourceforge dot net>
State:Final
Type:Project
Tcl-Version:8.5
Vote:Done
Created:Monday, 21 June 2004

Abstract

Proposes using two new virtual events, <<TraverseIn>> and <<TraverseOut>>, to notify widgets of keyboard navigation events.

Rationale

Certain widgets need to perform some action when they receive and/or lose keyboard focus because of keyboard traversal. For example, tabbing into an Entry or Spinbox widget selects the widget contents.

This cannot be done with a <FocusIn> binding, since widgets may receive <FocusIn> events for reasons other than keyboard traversal.

Tk currently implements this feature with special-case logic that checks the target window's widget class in the tk::TabToWindow procedure. The drawback to this approach is that it only works for the built-in widgets; third party widget sets like BWidget[1], IWidgets[2], and Tile[3] must implement their own workarounds.

Proposal

Change the standard Tk bindings for <Key-Tab> and <Shift-Key-Tab> to do the following:

Additionally, move the current code to handle traversal to Entry and Spinbox widgets from tk::TabToWindow to class bindings.

Implementation

See Tk Patch #976928[4].

The BWidget package has used an identical scheme since version 1.7; see Tcllib bug #720032[5] for details.

Copyright

This document has been placed in the public domain.


Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows