# listbox.tcl -- # # This file defines the default bindings for Tk listbox widgets # and provides procedures that help in implementing those bindings. # # @(#) listbox.tcl 1.11 95/06/04 17:30:09 # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1995 Sun Microsystems, Inc. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. #-------------------------------------------------------------------------- # tkPriv elements used in this file: # # afterId - Token returned by "after" for autoscanning. # listboxPrev - The last element to be selected or deselected # during a selection operation. # listboxSelection - All of the items that were selected before the # current selection operation (such as a mouse # drag) started; used to cancel an operation. #-------------------------------------------------------------------------- #------------------------------------------------------------------------- # The code below creates the default class bindings for listboxes. #------------------------------------------------------------------------- bind Listbox <1> { tkListboxBeginSelect %W [%W index @%x,%y] } bind Listbox { set tkPriv(x) %x set tkPriv(y) %y tkListboxMotion %W [%W index @%x,%y] } bind Listbox { tkCancelRepeat %W activate @%x,%y } bind Listbox { tkListboxBeginExtend %W [%W index @%x,%y] } bind Listbox { tkListboxBeginToggle %W [%W index @%x,%y] } bind Listbox { set tkPriv(x) %x set tkPriv(y) %y tkListboxAutoScan %W } bind Listbox { tkCancelRepeat } bind Listbox { tkListboxUpDown %W -1 } bind Listbox { tkListboxExtendUpDown %W -1 } bind Listbox { tkListboxUpDown %W 1 } bind Listbox { tkListboxExtendUpDown %W 1 } bind Listbox { %W xview scroll -1 units } bind Listbox { %W xview scroll -1 pages } bind Listbox { %W xview scroll 1 units } bind Listbox { %W xview scroll 1 pages } bind Listbox { %W yview scroll -1 pages } bind Listbox { %W yview scroll 1 pages } bind Listbox { %W xview scroll -1 pages } bind Listbox { %W xview scroll 1 pages } bind Listbox { %W xview moveto 0 } bind Listbox { %W xview moveto 1 } bind Listbox { %W activate 0 %W see 0 %W selection clear 0 end %W selection set 0 } bind Listbox { tkListboxDataExtend %W 0 } bind Listbox { %W activate end %W see end %W selection clear 0 end %W selection set end } bind Listbox { tkListboxDataExtend %W end } bind Listbox { if {[selection own -displayof %W] == "%W"} { clipboard clear -displayof %W clipboard append -displayof %W [selection get -displayof %W] } } bind Listbox { tkListboxBeginSelect %W [%W index active] } bind Listbox