diff options
author | Guido van Rossum <guido@python.org> | 1997-01-03 23:39:26 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-01-03 23:39:26 (GMT) |
commit | 7fc0bf82477bb3fee0e2caaba6fa031866602cd6 (patch) | |
tree | f91867dedd0606307284130c6bcdd86441ecbcbd | |
parent | bf0c3ca9bd9c4c37845cc6a4d15aa884f8d74830 (diff) | |
download | cpython-7fc0bf82477bb3fee0e2caaba6fa031866602cd6.zip cpython-7fc0bf82477bb3fee0e2caaba6fa031866602cd6.tar.gz cpython-7fc0bf82477bb3fee0e2caaba6fa031866602cd6.tar.bz2 |
Fix the following bug:
- When dragging the mouse in either listbox, the *first* entry
clicked on is selected rather than the last (but the last one is
highlighted).
This is done by changing the bindtags so that our binding is executed
after the default binding (which sets the 'active' index to the last
item selected), and using 'active' instead of 'anchor' as the index to
ask for.
-rw-r--r-- | Lib/lib-tk/FileDialog.py | 10 | ||||
-rwxr-xr-x | Lib/tkinter/FileDialog.py | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/Lib/lib-tk/FileDialog.py b/Lib/lib-tk/FileDialog.py index 76271af..fe98b6f 100644 --- a/Lib/lib-tk/FileDialog.py +++ b/Lib/lib-tk/FileDialog.py @@ -11,8 +11,6 @@ Classes: from Tkinter import * from Dialog import Dialog -ANCHOR = 'anchor' - import os import fnmatch @@ -73,6 +71,8 @@ class FileDialog: self.files = Listbox(self.midframe, exportselection=0, yscrollcommand=(self.filesbar, 'set')) self.files.pack(side=RIGHT, expand=YES, fill=BOTH) + btags = self.files.bindtags() + self.files.bindtags(btags[1:] + btags[:1]) self.files.bind('<ButtonRelease-1>', self.files_select_event) self.files.bind('<Double-ButtonRelease-1>', self.files_double_event) self.filesbar.config(command=(self.files, 'yview')) @@ -83,6 +83,8 @@ class FileDialog: yscrollcommand=(self.dirsbar, 'set')) self.dirs.pack(side=LEFT, expand=YES, fill=BOTH) self.dirsbar.config(command=(self.dirs, 'yview')) + btags = self.dirs.bindtags() + self.dirs.bindtags(btags[1:] + btags[:1]) self.dirs.bind('<ButtonRelease-1>', self.dirs_select_event) self.dirs.bind('<Double-ButtonRelease-1>', self.dirs_double_event) @@ -133,7 +135,7 @@ class FileDialog: def dirs_select_event(self, event): dir, pat = self.get_filter() - subdir = self.dirs.get(ANCHOR) + subdir = self.dirs.get('active') dir = os.path.normpath(os.path.join(self.directory, subdir)) self.set_filter(dir, pat) @@ -141,7 +143,7 @@ class FileDialog: self.ok_command() def files_select_event(self, event): - file = self.files.get(ANCHOR) + file = self.files.get('active') self.set_selection(file) def ok_event(self, event): diff --git a/Lib/tkinter/FileDialog.py b/Lib/tkinter/FileDialog.py index 76271af..fe98b6f 100755 --- a/Lib/tkinter/FileDialog.py +++ b/Lib/tkinter/FileDialog.py @@ -11,8 +11,6 @@ Classes: from Tkinter import * from Dialog import Dialog -ANCHOR = 'anchor' - import os import fnmatch @@ -73,6 +71,8 @@ class FileDialog: self.files = Listbox(self.midframe, exportselection=0, yscrollcommand=(self.filesbar, 'set')) self.files.pack(side=RIGHT, expand=YES, fill=BOTH) + btags = self.files.bindtags() + self.files.bindtags(btags[1:] + btags[:1]) self.files.bind('<ButtonRelease-1>', self.files_select_event) self.files.bind('<Double-ButtonRelease-1>', self.files_double_event) self.filesbar.config(command=(self.files, 'yview')) @@ -83,6 +83,8 @@ class FileDialog: yscrollcommand=(self.dirsbar, 'set')) self.dirs.pack(side=LEFT, expand=YES, fill=BOTH) self.dirsbar.config(command=(self.dirs, 'yview')) + btags = self.dirs.bindtags() + self.dirs.bindtags(btags[1:] + btags[:1]) self.dirs.bind('<ButtonRelease-1>', self.dirs_select_event) self.dirs.bind('<Double-ButtonRelease-1>', self.dirs_double_event) @@ -133,7 +135,7 @@ class FileDialog: def dirs_select_event(self, event): dir, pat = self.get_filter() - subdir = self.dirs.get(ANCHOR) + subdir = self.dirs.get('active') dir = os.path.normpath(os.path.join(self.directory, subdir)) self.set_filter(dir, pat) @@ -141,7 +143,7 @@ class FileDialog: self.ok_command() def files_select_event(self, event): - file = self.files.get(ANCHOR) + file = self.files.get('active') self.set_selection(file) def ok_event(self, event): |