Author: Jeff Hobbs <[email protected]>
State: Final
Type: Project
Created: 29-May-2002
Tcl-Version: 8.4
Vote: Done
Post-History:
Abstract
This TIP proposes to add a [-activestyle] option to the [listbox] widget that would control what style the active element has when the widget has focus (currently hard-coded to be underlined).
Rationale
Tk has always had an underline on the active item in listboxes, which is shown when the listbox has focus. However this in incompatible with the style of listboxes on Windows, especially as used in drop-down boxes. They instead have a thin dotted line to indicate the active item. In order to improve native look and feel, we would allow the user to request the style which indicates the active item.
Specification
$listbox configure -activestyle none|underline|dotbox
The default would be underline, which stays consistent with the current behavior. dotbox is the Windows style, which is essentially the dotted focus ring that any item with focus receives. While Windows does have a special API (DrawFocusRect) to draw this, it should be possible with the features of the dash patch to emulate on Unix. It may not be possible to draw a dotbox easily on MacOS, in which case the option will be allowed, but nothing would be drawn (rather than dropping back to underline).
Reference Implementation
This implementation is simple and would only extend one check in DisplayListbox for whether the underline should be drawn.
File: tcl/generix/tkListbox.c
Function: DisplayListbox
Copyright
This document has been placed in the public domain.