summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorrjohnson <rjohnson>1998-10-10 00:30:34 (GMT)
committerrjohnson <rjohnson>1998-10-10 00:30:34 (GMT)
commit6b30648b424171905375ec916ab86186a3043dfc (patch)
tree5d1b6c4f80c96cbc9337259a6d98a40a78aff79b /library
parent733f2ab4691d31c0fdca72da988c5f4878ee5709 (diff)
downloadtk-6b30648b424171905375ec916ab86186a3043dfc.zip
tk-6b30648b424171905375ec916ab86186a3043dfc.tar.gz
tk-6b30648b424171905375ec916ab86186a3043dfc.tar.bz2
Added support for the MouseWheel event.
Diffstat (limited to 'library')
-rw-r--r--library/listbox.tcl11
-rw-r--r--library/text.tcl11
2 files changed, 20 insertions, 2 deletions
diff --git a/library/listbox.tcl b/library/listbox.tcl
index ebef6ed..45f0b9b 100644
--- a/library/listbox.tcl
+++ b/library/listbox.tcl
@@ -3,10 +3,11 @@
# This file defines the default bindings for Tk listbox widgets
# and provides procedures that help in implementing those bindings.
#
-# RCS: @(#) $Id: listbox.tcl,v 1.3 1998/09/14 18:23:23 stanton Exp $
+# RCS: @(#) $Id: listbox.tcl,v 1.4 1998/10/10 00:30:36 rjohnson Exp $
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+# Copyright (c) 1998 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -171,6 +172,14 @@ bind Listbox <B2-Motion> {
%W scan dragto %x %y
}
+# The MouseWheel will typically only fire on Windows. However,
+# someone could use the "event generate" command to produce one
+# on other platforms.
+
+bind Listbox <MouseWheel> {
+ %W yview scroll [expr - (%D / 120) * 4] units
+}
+
# tkListboxBeginSelect --
#
# This procedure is typically invoked on button-1 presses. It begins
diff --git a/library/text.tcl b/library/text.tcl
index b0bc2e5..6ef185c 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -3,10 +3,11 @@
# This file defines the default bindings for Tk text widgets and provides
# procedures that help in implementing the bindings.
#
-# RCS: @(#) $Id: text.tcl,v 1.4 1998/09/14 18:23:25 stanton Exp $
+# RCS: @(#) $Id: text.tcl,v 1.5 1998/10/10 00:30:36 rjohnson Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright (c) 1998 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -447,6 +448,14 @@ bind Text <B2-Motion> {
}
set tkPriv(prevPos) {}
+# The MouseWheel will typically only fire on Windows. However,
+# someone could use the "event generate" command to produce one
+# on other platforms.
+
+bind Text <MouseWheel> {
+ %W yview scroll [expr - (%D / 120) * 4] units
+}
+
# tkTextClosestGap --
# Given x and y coordinates, this procedure finds the closest boundary
# between characters to the given coordinates and returns the index