home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!agate!agate!adrianho
- From: adrianho@barkley.berkeley.edu (Adrian J Ho)
- Newsgroups: comp.lang.tcl
- Subject: Re: bind: How to select using Button-3
- Message-ID: <ADRIANHO.92Aug18074134@barkley.berkeley.edu>
- Date: 18 Aug 92 12:41:34 GMT
- References: <1992Aug18.123400.3968@gmd.de>
- Organization: University of California, Berkeley
- Lines: 29
- NNTP-Posting-Host: barkley.berkeley.edu
- In-reply-to: richard@borneo.gmd.de's message of 18 Aug 92 12:34:00 GMT
-
- In article <1992Aug18.123400.3968@gmd.de> richard@borneo.gmd.de (Richard Czech) writes:
- >I have a Tcl/Tk application in which I want to have different bindings
- >for Button-1 and Button-3 in several listboxes as follows:
- >[...]
- >It works fine for Button-1, because the selection of elements in
- >listboxes is predefined for Button-1. [...] But how is this done?
-
- In general, questions about default class bindings can be answered by
- looking at $tk_library/tk.tcl, in which all class bindings are found.
- (Larry, I think this little-known fact qualifies for the FAQ. 8-)
-
- In the case of listboxes, there is no binding for <B1-ButtonRelease>,
- so you'll have to add that yourself, like this:
-
- bind Listbox <B1-ButtonRelease> {echo foo [%W curselection]}
-
- >Can I define the same functionality for Button-3 using the bind command?
-
- Sure.
-
- bind Listbox <3> {%W select from [%W nearest %y]}
- bind Listbox <B3-Motion> {%W select to [%W nearest %y]}
- bind Listbox <B3-ButtonRelease> {echo bar [%W curselection]}
- --
- -----------------------------------------------------------------------------
- Adrian Ho, He With The Embarrassingly *Dead* Passion ** Phone: (510) 642-5563
- System Manager, CFD Lab, ME Dept, UC Berkeley * adrianho@barkley.berkeley.edu
- Maintainer, Tcl/Tk Contrib Archive ---- barkley.berkeley.edu [128.32.142.237]
- Send all Tcl/Tk Archive-related stuff to tcl-archive@barkley.berkeley.edu
-