Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[tablelist] Unexpected/Different behavior on Escape key

108 views
Skip to first unread message

Alexandru

unread,
Mar 15, 2017, 3:58:25 AM3/15/17
to
Hi,

When I select one or more rows in a tablelist widget and then I press Escape key, I expect that the selection is removed. Unfortunately this doesn't work with "-selectmode single". It does work whith "-selectmode extended". In my opinion removing selection should work for all cases of -selectmode. Or is there another option somewhere to achieve this?

Regards
Alexandru

nemethi

unread,
Mar 15, 2017, 5:02:24 AM3/15/17
to Alexandru Dadalau
The tablelist widget behaves very much like the Tk core listbox. From
the Tablelist reference manual:


"If the selection type is *row* (which is the default) then everything
described in the "DEFAULT BINDINGS" section of the *listbox* manual
entry applies to the body component of a tablelist, too. The only
difference is that the word "element" in that manual page has to be
replaced with "item" when applying the description to the body of a
tablelist widget.

If the selection type is *cell* then everything described in the
"DEFAULT BINDINGS" section of the *listbox* manual entry applies to the
body component of a tablelist, too, with the following extensions and
changes:

..."


From the listbox manual page:

"In *extended* mode, the Escape key cancels the most recent selection
and restores all the elements in the selected range to their previous
selection state."

This is the documented behavior of the listbox widget, and thus of the
tablelist widget, too.

--
Csaba Nemethi http://www.nemethi.de mailto:csaba....@t-online.de

Alexandru

unread,
Mar 15, 2017, 6:26:21 AM3/15/17
to
Hi Csaba,

How can I remove the selection from the tablelist, when "-selectmode single"? This should be possible but at least on my machine it's not working.

nemethi

unread,
Mar 15, 2017, 6:55:56 AM3/15/17
to
Again, the listbox manual is your friend:

"Control-backslash deselects everything in the widget, except in
*browse* mode where it has no effect."

Alexandru

unread,
Mar 15, 2017, 8:10:06 AM3/15/17
to
Thanks. I read the manual and the specified behavior (CTRL-backslash) has no effect on my Windows 7 machine with German keyboard.

Besides, we can agree that Escape is more intuitive than pressing 3(!) keys at the same time on the keyboard in order to generate CTRL-backslash. Who came up with this idea anyway?? What is the reason for having two totally different ways for simply removing the selection???

So I understand, that the tablelist imports the default bindings from listbox but my question is how can we still do this in tablelist. I could define a callback function on mouse click events... Perhaps it's worth thinking about making this the default behavior in tablelist?




nemethi

unread,
Mar 15, 2017, 12:08:20 PM3/15/17
to
It works for me as expected on Linux, not only for tablelists but also
for the Tk core entry, listbox, spinbox and text widgets. You are
right, however, that it doesn't work on Windows (for any of the
above-mentioned widgets). This is because the Windows port of Tk
apparently doesn't recognize the <Control-backslash> key sequence on a
German keyboard (where in addition the <AltGr> key must be pressed).

> Besides, we can agree that Escape is more intuitive than pressing 3(!) keys at the same time on the keyboard in order to generate CTRL-backslash. Who came up with this idea anyway?? What is the reason for having two totally different ways for simply removing the selection???

Please read the manual more carefully: "... the Escape key cancels the
most recent selection and restores all the elements in the selected
range to their previous selection state", while "Control-backslash
deselects everything in the widget, ...". These are two quite different
actions, and, in addition, the first one is listbox and tablelist
specific, while the second one applies to entry, spinbox and text
widgets, too.

The use of the <Control-backslash> key sequence for deselecting
everything is very probably a legacy from the old Motif times.
Interestingly, while <Control-a> is nowadays universally supported as an
alternative to <Control-slash> for selecting everything (and this is
valid *on Windows* for *recent* Tk releases, too), there seems to be no
standard shortcut for the opposite operation. On X11, in *some* text
editors (like gedit), the <Control-backslash> key sequence will deselect
everything, while in some others (like KWrite) it is not supported at all.

> So I understand, that the tablelist imports the default bindings from listbox but my question is how can we still do this in tablelist. I could define a callback function on mouse click events... Perhaps it's worth thinking about making this the default behavior in tablelist?

Since on Windows, in recent Tk versions <Control-Key-a> can be used to
select everything, I could add support for <Shift-Control-Key-A> as
alternative shortcut for deselecting everything in a tablelist. In
addition, I would submit a Tk enhancement request, proposing that this
key sequence be supported for entry, listbox, spinbox and text widgets,
too (actually, there is a central place for changes like this in the Tk
library file tk.tcl).

Alexandru

unread,
Mar 15, 2017, 12:26:50 PM3/15/17
to
Thanks for the support.
Okay, so we can forget about the manual. I'll never comply with stone-age key bindings. If necessary I'll overwrite whose.
CTRL-Shift-A is equally non-intuitive as CTRL-backslash.
Why not the simple way? Escape removes selection. Period.

P.S.:As a user I never needed to restore the previous selection in a tablelist. Am I the only one?

nemethi

unread,
Mar 15, 2017, 1:27:20 PM3/15/17
to
I cannot agree. Why can we forget about the manual? The "most recent
selection" is definitely not the same as "everything". You can easily
see this in a listbox or tablelist widget having -selectmode extended.
In this case you can have several selected regions, and <Escape> will
only clear the most recently selected one, leaving the others unchanged.
What you are proposing (namely that <Escape> should remove all the
selection), would destroy the compatibility between tablelist and
listbox widgets. For me, "the simple way" is only acceptable if it
doesn't give rise to any incompatibilities (including backward ones, not
only the compatibility between tablelist and listbox widgets).

Also, being that <Control-Key-a> is a universally accepted shortcut, I
find that <Shift-Control-Key-A> is just intuitive enough.

Alexandru

unread,
Mar 15, 2017, 4:47:25 PM3/15/17
to
I can only say, that among Windows users, if they are put in front of the task to clear selection in a tablelist, they will all automatically press the Escape key. This is why we can forget about the manual. Users of my software don't even know what Tcl is, so implicitly they don't know about the manual and surely don't know about Linux key shortcuts. But never mind, I guess I can implement the wanted key binding my self, right?

Cheers
Alexandru

nemethi

unread,
Mar 15, 2017, 6:05:15 PM3/15/17
to
Are you sure that Windows users will automatically try to clear the
selection with the aid of the Escape key? Can you give me an example of
a Windows application where the shortcut for clearing the selection is
the Escape key?

Alexandru

unread,
Mar 15, 2017, 6:19:28 PM3/15/17
to
Yes, PowerPoint.
Perhaps I should elaborate my understanding of how a Windows user will react:
1. User selects one row in the tablelist.
2. User wants to remove selection by clicking again while holding the CTRL key pressed (Explorer behavior).
3. Since selection still remains unchanged, user presses the Escape key.
4. Since selection still remains unchanged, user closes my software probably loosing a swearword :(

Christian Gollwitzer

unread,
Mar 15, 2017, 6:49:05 PM3/15/17
to
Am 15.03.17 um 23:19 schrieb Alexandru:
Haha :) Another reasonable try would be to click into the empty space,
i.e. outside of an entry.

I see no reason why you can't implement the binding yourself. Something
like
bind $tbl <Escape> [list $tbl selection clear 0 end]
should do the trick faster than you write the next rant ;)

Christian

Alexandru

unread,
Mar 15, 2017, 7:15:54 PM3/15/17
to
Am Mittwoch, 15. März 2017 23:49:05 UTC+1 schrieb Christian Gollwitzer:
> Am 15.03.17 um 23:19 schrieb Alexandru:
> > Am Mittwoch, 15. März 2017 23:05:15 UTC+1 schrieb nemethi:
> >>
> >> Are you sure that Windows users will automatically try to clear the
> >> selection with the aid of the Escape key? Can you give me an example of
> >> a Windows application where the shortcut for clearing the selection is
> >> the Escape key?
> >
> > Yes, PowerPoint.
> > Perhaps I should elaborate my understanding of how a Windows user will react:
> > 1. User selects one row in the tablelist.
> > 2. User wants to remove selection by clicking again while holding the CTRL key pressed (Explorer behavior).
> > 3. Since selection still remains unchanged, user presses the Escape key.
> > 4. Since selection still remains unchanged, user closes my software probably loosing a swearword :(
> >
>
> Haha :) Another reasonable try would be to click into the empty space,
> i.e. outside of an entry.
Out of design reasons, the tables are configured to have no empty spaces...
>
> I see no reason why you can't implement the binding yourself. Something
> like
> bind $tbl <Escape> [list $tbl selection clear 0 end]
> should do the trick faster than you write the next rant ;)
Deep inside I was still hoping to turn Csaba to implement this as a default...

>
> Christian

nemethi

unread,
Mar 16, 2017, 6:54:38 AM3/16/17
to
The bind invocation above needs a few changes to make it work:

bind [$tbl bodytag] <Escape> {
[tablelist::getTablelistPath %W] selection clear 0 end
}

The complete solution generates the <<TablelistSelect>> event, too:

bind [$tbl bodytag] <Escape> {deselectAll %W}

proc deselectAll w {
set tbl [tablelist::getTablelistPath $w]
$tbl selection clear 0 end
event generate $tbl <<TablelistSelect>>

nemethi

unread,
Mar 16, 2017, 7:09:53 AM3/16/17
to
As already explained, this would be an incompatible change, hence it
cannot become the default.

Regarding PowerPoint: In which part of the application (in which
functionality) is the Escape key the shortcut for clearing the
selection? I haven't found it, but this might be because I have only
rudimentary working knowledge of PowerPoint.

Alexandru

unread,
Mar 16, 2017, 1:34:58 PM3/16/17
to
If you implement the Escape binding only for the case with the option "row" and "single", then it's not an incompatibility, since until now there is no other binding for Escape key for those cases. Right?

> Regarding PowerPoint: In which part of the application (in which
> functionality) is the Escape key the shortcut for clearing the
> selection? I haven't found it, but this might be because I have only
> rudimentary working knowledge of PowerPoint.

It clears the selection of any selected graphical objects in a slide.

Rich

unread,
Mar 16, 2017, 2:07:40 PM3/16/17
to
But it (Escape key) does nothing to the selection within a windows file
explorer window (just tested on Win7 with single select, shift
multi-select and control multi-select). And you did mention 'explorer'
somewhere several messages back in this thread as the windows UI that
users would think of when using your UI.

It (Escape) also has zero effect on the selection in Outlook 2013, Word
2013, and Excel 2013 [1]. These four (Explorer, Outlook, Word, Excel)
will be where a huge majority of windows users form their "I expect
this key to do that" mental processes from. So unless you are
targeting a majority of heavy PowerPoint users it is unlikely that any
of your windows users will ever think "press Escape to clear selection"
on their own. They might discover it by accident one day in your UI,
or they might be explicitly trained to use it in your UI, but they'd
never think to try it up front on their own such that they'd be
frustrated when it did not work as they expect.

[1] Escape in Excel does clear the dotted box that indicates what cells
were most recently copied to the clipboard, but that box is not "the
selection".

Alexandru

unread,
Mar 16, 2017, 2:15:33 PM3/16/17
to
Am Donnerstag, 16. März 2017 19:07:40 UTC+1 schrieb Rich:
> Alexandru wrote:
> > Am Donnerstag, 16. März 2017 12:09:53 UTC+1 schrieb nemethi:
> >> Regarding PowerPoint: In which part of the application (in which
> >> functionality) is the Escape key the shortcut for clearing the
> >> selection? I haven't found it, but this might be because I have
> >> only rudimentary working knowledge of PowerPoint.
> >
> > It clears the selection of any selected graphical objects in a slide.
>
> But it (Escape key) does nothing to the selection within a windows file
> explorer window (just tested on Win7 with single select, shift
> multi-select and control multi-select). And you did mention 'explorer'
> somewhere several messages back in this thread as the windows UI that
> users would think of when using your UI.
No, I didn't: "User wants to remove selection by clicking again while holding the CTRL key pressed (Explorer behavior). "
>
> It (Escape) also has zero effect on the selection in Outlook 2013, Word
> 2013, and Excel 2013 [1]. These four (Explorer, Outlook, Word, Excel)
> will be where a huge majority of windows users form their "I expect
> this key to do that" mental processes from. So unless you are
> targeting a majority of heavy PowerPoint users it is unlikely that any
> of your windows users will ever think "press Escape to clear selection"
> on their own. They might discover it by accident one day in your UI,
> or they might be explicitly trained to use it in your UI, but they'd
> never think to try it up front on their own such that they'd be
> frustrated when it did not work as they expect.

I'm aware of all these and still, I'm pretty sure that users will behave like this (not that Escape is not necessary the first try):
1. User selects one row in the tablelist.
2. User wants to remove selection by clicking again while holding the CTRL key pressed (Explorer behavior).
3. Since selection still remains unchanged, user presses the Escape key.

>

Alexandru

unread,
Mar 16, 2017, 2:17:19 PM3/16/17
to
At least the "CTRL+click" on the selected single row should remove selection.

Rich

unread,
Mar 16, 2017, 2:58:07 PM3/16/17
to
I'm with you up to here. They *will* try to control+click again to
turn off a row (at least those who even know about control+click). And
I submit that any "frustration" with your UI not working as expected
would arrive here, not in your step 3, in that they would be frustrated
that control+click did not work as they expected.

At the same time, tablelist is trying to be cross platform, and that,
pretty much by definition, will mean "does not act 100% identically to
all the 'norms' of any one platform".

> 3. Since selection still remains unchanged, user presses the Escape
> key.

What evidence to you have to present to support your assertion here?

The big four (Explorer, Outlook, Word, Excel) which are four out of the
"big five" (a browser) that many (most?) windows users will _ever_
interact with, do not have the Escape key mapped to clear the selection
in any way. So how/why would a windows user, accustomed to the big
four's selection handling, ever think of even trying the Escape key as
a way to clear the the selection? I submit that for that user set
(those steeped in the ways of the big four) that if you were to ask
them if their keyboard contained an Escape key they would answer "I
don't know, what is an Escape key?".

Alexandru

unread,
Mar 16, 2017, 5:31:10 PM3/16/17
to
You might be right. I don't know. Perhaps I'm not able to estimate what the average user knows. Perhaps it's because the users of my software are engineers. Pretty sure they will press that Escape key... However this discussion won't lead to anywhere without some other Windows users saying their opinion here in this forum. Until then it's worth to note that the tablelist has no way of deselecting a selected row in -selectmode "row" or "single" other than clicking on an empty space (if this exists). You can name it "compatibility" and "cross platform". I name it "usability issue".

Regards
Alexandru

Alexandru

unread,
Mar 16, 2017, 5:37:52 PM3/16/17
to
Am Donnerstag, 16. März 2017 22:31:10 UTC+1 schrieb Alexandru:
>
> You might be right. I don't know. Perhaps I'm not able to estimate what the average user knows. Perhaps it's because the users of my software are engineers. Pretty sure they will press that Escape key... However this discussion won't lead to anywhere without some other Windows users saying their opinion here in this forum. Until then it's worth to note that the tablelist has no way of deselecting a selected row in -selectmode "row" or "single" other than clicking on an empty space (if this exists). You can name it "compatibility" and "cross platform". I name it "usability issue".
>
> Regards
> Alexandru

By the way, in "-selectmode multiple" the Escape key restores the previous selection state. Why is this not true for "single" mode? Please don't give me the "backward compatibility" thing. Is there a logic for this? Since most users don't even know where the Escape key is, it shouldn't be the end of the world changing this. An I mean change also the listbox widget.

nemethi

unread,
Mar 16, 2017, 6:17:59 PM3/16/17
to
1. There is no -selectmode "row".

2. Clicking on an empty space doesn't deselect a selected row.

3. We have already clarified that <Control-backslash> deselects
everything in the widget, except in browse mode where it has no effect.
We have also clarified that this works on Linux but fails on Windows
with a German keyboard, and that this is no Tablelist-specific issue.

4. To solve your problem, I proposed to add support for
<Shift-Control-a> to Tablelist as an alternative to <Control-backslash>
that would work with German (and other non-US) keyboards, too (BTW,
e.g., the Linux editor KWrite supports this shortcut). You found,
however, that this is non-intuitive and proposed the <Escape> key in its
place, although (as pointed out by Rich) it is far from being widely
known as a shortcut for deselecting everything.

5. IMHO, regardless of the choice of the new shortcut, your application
will have to teach the user how to clear the selection. There are
wide-spread ways for this (e.g., a new menu item like "Clear Selection

nemethi

unread,
Mar 16, 2017, 6:22:39 PM3/16/17
to
Sorry, sent it too early.

5. IMHO, regardless of the choice of the new shortcut, your application
will have to teach the user how to clear the selection. There are
wide-spread ways for this (e.g., a menu item like "Clear Selection
Shift+Control+A").

nemethi

unread,
Mar 16, 2017, 6:42:27 PM3/16/17
to
This is not the case in "-selectmode multiple", but in "-selectmode
extended". Anyway, you are free to add your own custom bindings to your
application, but making them the default (even Tk-wide) is a different
story.

Andreas Leitgeb

unread,
Mar 17, 2017, 7:04:59 AM3/17/17
to
Since tablelist's bindings are by specification "bound" to listbox
wrt bindings, the discussion had better target listbox.
Tablelist ist just the wrong tree to bark up.

I happen to agree with Alexandru, that the bindings of listbox leave
much to wish for, and have bindings that "almost but not quite entirely"
fail to be useful.

e.g.: Escape in "extended" mode does not really undo the last sel-action,
as might be useful, nor does it "clear the selection" outside a specific
click-history. It only undoes the last "selecting"-action, while logically
splitting up a user-action into a deselection and a selection part - only
undoing the second. In practice a user might have browsed a long list, and
selected a couple of items using Ctrl-click to add to selection. Then,
accidentally, he fails to hit the Ctrl-key properly and all the previous
selection is replaced by the latest-clicked item. At this point, Escape
won't undo the mistake. It won't bring back the previous selection, but
only unselect that latest bit.

Given, that Escape even in extended mode performs a goofy task, it might
be better left out altogether, allowing Escape to propagate up the window
stack and maybe close some dialog that contains the listbox.

The suggested Ctrl-Shift-A binding makes sense to me, since at least the
Ctrl-A is common enough to let some users try it together with Shift for
the opposite effect.

Ctrl-slash and Ctrl-backslash are pretty clumsy on German keyboards, even
where they work (Linux here). Even the Ctrl-/ needs to be typed as
Ctrl-Shift-7 on that layout. That could be a reason why these bindings
hardly got any traction in other toolkits.

Alexandru

unread,
Mar 17, 2017, 10:07:04 AM3/17/17
to
Thanks Andreas. You're right, the problem sits deeper than the tablelist.
I thinking of conducting a small study among my contacts about which keys are pressed in order to deselect rows in a list.
On the other side I have the feeling that developers are overreacting to changing something due to "incompatibilities" whereas I think that changing something would be more than welcomed by pure users.

briang

unread,
Mar 17, 2017, 5:35:50 PM3/17/17
to
On Wednesday, March 15, 2017 at 12:58:25 AM UTC-7, Alexandru wrote:
> Hi,
>
> When I select one or more rows in a tablelist widget and then I press Escape key, I expect that the selection is removed. Unfortunately this doesn't work with "-selectmode single". It does work whith "-selectmode extended". In my opinion removing selection should work for all cases of -selectmode. Or is there another option somewhere to achieve this?
>
> Regards
> Alexandru

I don't know about the tablelist, but with the listbox widget, there is an interaction between "-exportselection 1" and "-selectionmode single". My guess is that as long as the widget "owns" the current selection, something must be selected. If "-exportselection" is disabled, then <Escape> works fine.

-Brian

nemethi

unread,
Mar 21, 2017, 7:24:25 AM3/21/17
to
I have taken a closer look at how the selection is toggled and cleared,
both on Windows and X11 (Linux):

1. The selection state of the active/current item is toggled with
<Control-space>, both on Windows and Linux. The best examples for this
are Windows Explorer and Task Manager on Windows and similar tools on
Linux. Strangely enough, this shortcut doesn't seem to be widely known.
While the Tk core listbox and Tablelist support <Control-Button-1> in
the extended selection mode only, all Linux tools that I have looked at
support it in single-selection lists, too. I found this quite useful.

2. There is no standard way for clearing the selection (i.e.,
deselecting everything), but many applications support the key sequence
<Shift-Control-A> for this purpose. A few examples: KWrite, Kate, GIMP,
Adobe Flash, and the "Processes" tab in System Monitor on Linux. At
least GIMP and Flash run on Windows, too.

The intensive discussion in this thread has determined me to add a few
new features to Tablelist, aimed at improving its user-friendliness and
compatibility with other frameworks. Those bindings that are not
strictly listbox-compatible are only enabled if the new boolean variable
tablelist::strictTk is false. However, since the default value of this
variable is 0, the new features will be enabled per default.

A few snippets from the updated reference manual:

-----
*BINDINGS FOR THE SELECTION TYPE row:* ...

1. If tablelist::strictTk is false (which is the default) then
pressing button 1 with the Control key down toggles the selection state
of the item under the mouse. If the selection mode is extended then
additional actions apply, as described in the listbox manual entry. If
the selection mode is single or browse and the selection state of the
item changes from unselected to selected then any other selected items
will be deselected, just as if button 1 had been pressed without the
Control key down.

2. Again, if tablelist::strictTk is false, then Control-space and
Control-Select toggle the selection state of the active item just as if
button 1 had been pressed over this item with the Control key down.

*BINDINGS FOR THE SELECTION TYPE cell:* ...

(similar)

*BINDINGS FOR SELECT ALL AND DESELECT ALL:* The following additional
bindings associated with the binding tag TablelistBody are valid on the
windowing systems x11 and win32:

1. Control-a behaves the same as Control-slash, i.e., it selects
everything in the widget, except in single and browse modes, in which
case it selects the active item or element (depending on the selection
type) and deselects everything else.

REMARK 1: The default widget bindings in current Tk versions on
Windows already support Control-a as an alternative to Control-slash.
In Tablelist this is now valid on X11, too.

REMARK 2: On Mac OS X Aqua, the default widget bindings in
current Tk versions use the key sequence Command-a instead of Control-slash.

2. Shift-Control-A behaves the same as Control-backslash, i.e., it
deselects everything in the widget, except in browse mode where it has
no effect.

REMARK 1: This shortcut comes in handy on Windows when using,
e.g., a French or German keyboard, because in this case Tk fails to
recognize the Control-backslash key sequence (for which one has to press
Control, AltGr, and a third key: _ on a French and ß on a German
keyboard). Moreover, on many keyboards it is quite difficult (if not
even impossible) to generate the Control-backslash key sequence, fact
which makes the support for this alternative shortcut even more useful
on both X11 and Windows.

REMARK 2: On Mac OS X Aqua, the default widget bindings in
current Tk versions use the key sequence Option-Command-a instead of
Control-backslash.
-----

I think that these new features will make the selection handling in
Tablelist widgets much more user-friendly. And I hope that Alexandru
will be happy with them, too. :-)

Harald Oehlmann

unread,
Mar 21, 2017, 9:12:22 AM3/21/17
to
Am 21.03.2017 um 12:24 schrieb nemethi:
> I think that these new features will make the selection handling in
> Tablelist widgets much more user-friendly. And I hope that Alexandru
> will be happy with them, too. :-)
>
Thanks Csaba, you rock !
Harald

Alexandru

unread,
Mar 21, 2017, 5:38:40 PM3/21/17
to
Yes indeed. I'm very happy now. Thank you for the quick support and implementation.

BTW, I was talking with two Windows users and asked them, what they would do to de-select something in a table. Don't misinterpret this - I don't want to make it a default any more - but they immediately said they would press the Escape key. I told them, that Escape is almost never the key for this kind of action, but they said, they do this intuitively anyway. I found this very funny...

Regards
Alxandru

Alexandru

unread,
Mar 21, 2017, 5:42:53 PM3/21/17
to
Am Dienstag, 21. März 2017 12:24:25 UTC+1 schrieb nemethi:
Hi Csaba,

On your website I still see the old version. You didn't updated yet, right?

nemethi

unread,
Mar 21, 2017, 6:27:57 PM3/21/17
to
I haven't released the new version yet, but I will do it within the next
few days.
0 new messages