\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#94: Add Listbox -activestyle Option}
\date{May 29, 2002}
\author{Jeff Hobbs}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#94}&\textbf{Add Listbox -activestyle Option}\\\hline
Author&

Jeff Hobbs \tipmail{JeffH}{ActiveState.com}
\\
Created&Wednesday, \(\text{29}^{\text{th}}\) May 2002\\
Type&Project\\
Tcl Version&\(8.4\)\\
State&Final\\
Vote&Done\\
Version&\tipversion$Revision: 1.5 $\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

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).
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{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.

\section{Specification}
\begingroup\small\begin{verbatim}
    $listbox configure -activestyle none|underline|dotbox
\end{verbatim}
\endgroup

The default would be underline, which stays consistent with the current behavior. \textit{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 (\textit{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).

\section{Reference Implementation}

This implementation is simple and would only extend one check in \textit{DisplayListbox} for whether the underline should be drawn.

File: \textit{tcl/generix/tkListbox.c}

Function: \textit{DisplayListbox}

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
