Listboxes

   

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

Table of Contents
Chapter 48.  Tcl 7.4/Tk 4.0


Listboxes changed quite a bit in Tk 4.0. See Chapter 32 for all the details. There are now four Motif-like selection styles, and two of these support disjoint selections. The tk_listboxSingleSelect procedure no longer exists. Instead, configure the selectMode attribute of the listbox. A listbox has an active element, which is drawn with an underline. It is referenced with the active index keyword.

The selection commands for listboxes have changed. Change:

 $listbox select from index1 $listbox select to index2 

to:

 $listbox select anchor index1 $listbox select set anchor index2 

The set operation takes two indices, and anchor is a valid index, which typically corresponds to the start of a selection.

You can selectively clear the selection, and query if there is a selection in the listbox. The command to clear the selection has changed. It requires one or two indices. Change:

 $listbox select clear 

to:

 $listbox select clear 0 end 

       
    Top
     



    Practical Programming in Tcl and Tk
    Practical Programming in Tcl and Tk (4th Edition)
    ISBN: 0130385603
    EAN: 2147483647
    Year: 1999
    Pages: 478

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net