Tk Source Code

View Ticket
Login
Ticket UUID: 3555644
Title: Better use of virtual events.
Type: Bug Version: obsolete: 8.5.13
Submitter: jan.nijtmans Created on: 2012-08-09 10:59:40
Subsystem: 01. Bindings Assigned To: jan.nijtmans
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2014-03-13 09:17:22
Resolution: Fixed Closed By: nijtmans
    Closed on: 2013-01-08 10:55:08
Description:
Some observations:
- In listbox.tcl, <Control-Left> is bound to scrolling back a page, but on
  Mac it should be bound to <Option-Left>
- in console,tcl <Control-a> and <Home> are both bound to the same
  action.
- many more of similar examples, all related to the 6 virtual events
  mentioned below.

All of those (and more) can be solved by using the virtual events
<<PrevChar>>, <<NextChar>>, <<PrevWord>>, <<NextWord>>
<<LineStart>> and <<LineEnd>> in stead of <Left>, <Right>,
<Control-Left>, <Control-Right>, <Home/Control-Key-a> and
<End/Control-Key-e> in all bindings.
User Comments: nijtmans added on 2013-01-08 17:55:06:
Fixed in Tk 8.6.0. Cannot be backported to 8.5.

nijtmans added on 2012-08-23 17:50:32:
Merge to trunk.

Thanks!

treincke added on 2012-08-23 14:26:32:
Ah, great. Yes, this is what I meant. Thanks!

nijtmans added on 2012-08-23 14:09:12:
Is this what you mean:
<http://core.tcl.tk/tk/ci/1b0ecb59de?sbs=1>
committed to bug-3555644 branch

Actually, it is used in ttk/entry.tcl as well, so a
virtual event seems appropriate. And this
is exactly what virtual events are for.

Doc not updated yet (should be done before
merging to trunk, just a reminder to myself...)

treincke added on 2012-08-23 13:30:17:
What about ttk::treeview and the <Control-ButtonPress-1> binding? On the Mac this toggles the selection (in -selectmode extended). But it should actually be <Command-ButtonPress-1> to be consistent with the normal Mac behavior. This can easily be added to library/ttk/treeview.tcl, but could also be done as a new virtual event, e.g.<<ToggleSelection>>

nijtmans added on 2012-08-10 19:58:31:
Added two more virtual events, <<SelectAll>> and
<<SelectNone>>. Fixed the OSX bindings for
those two, according to Apple's documentation.

nijtmans added on 2012-08-09 22:02:49:
>This suggests 8 new virtual events that should be considered:
Committed now to the bug-3555644 branch. Doc not updated yet.

nijtmans added on 2012-08-09 21:06:55:
> <Up> -> <<NextLine>>
Of course, that should be:
<Up> -> <<PrevLine>>
    ;-)

nijtmans added on 2012-08-09 21:06:10:
Those 6 virtual events already exist, they are only not used yet in all widgets.

Just found:
<http://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts>

This suggests 8 new virtual events that should be considered:
<Up>    ->   <<NextLine>>
<Shift-Up>    -> <<SelectNextLine>>
<Control-Up>   ->  <<NextPara>>
<Shift-Control-Up>    -> <<SelectNextPara>>
and the same for <Down>. This way, the
    if {[tk windowingsystem] eq "aqua"} {
(in text.tcl) can almost be removed, while
the "Option" variants will start to work
for the Mac in all widgets, not only "text"

dkf added on 2012-08-09 20:07:09:
Keeping open (because it's still in a dev branch).

I'm generally fairly supportive of the approach. We need to make sure that we've got the list of "standard" virtual events listed somewhere; event.n contains what I've done so far but the list probably needs updating in response to this.

nijtmans added on 2012-08-09 18:05:21:
Committed to branch "bug-3555644".

Jeff, Joe (because it involves ttk too), please evaluate.
- Can I safely do this without problems for existing applications?
- Should this be backported to Tk 8.5 as well?