Tk Source Code

View Ticket
Login
Ticket UUID: ca4df9e4d63f18d1672880d17bd15d09e033a5dd
Title: Dubious features of Text widgets
Type: RFE Version: 8.6 / 8.7
Submitter: marc_culler Created on: 2017-10-30 21:33:50
Subsystem: 18. [text] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2017-10-31 04:10:15
Resolution: None Closed By: nobody
    Closed on:
Description:
By a dubious feature I mean one which either forces, or makes it too convenient
for a programmer to create things that don't work.  Here are three of these
that appear with Text widgets on all platforms.

1. The ability to create embedded windows which do not appear in peer widgets.

2. The ability to use different fonts in a Text widget and its peers.

3. The fact that scrollwheel events do not get delivered to the Text widget
   when the cursor is over a button.

All of these are visible in the demo #4 for Text widgets when you click the
button to create "Split Windows".  The demo itself discusses #1 and indicates
how to avoid this behavior.  The demo advertises #2, but does not discuss how
it breaks genuinely useful features of the Text widget.  What breaks most
obviously is the wrapping algorithm of the Text.  If you look at the right
hand panel of the split window you will see (on all platforms) that the second
line begins with a period and many other lines are split in the middle of a
word.  The problem caused by #3 is also visible on the right side.  It is not
possible to use the scrollbar to scroll the panel on the right, even though the
scrollbar position does get updated when you scroll the right hand panel with
the scrollwheel or by using two fingers on a trackpad.  So, really, the
scrollwheel is the only way to scroll the right panel and if the cursor happens
to be located over a button, or if a button happens to scroll to a position
under the cursor, then scrolling becomes impossible until the cursor is moved.
User Comments: bll added on 2017-10-31 04:10:15:
#3

I certainly agree that it is unexpected, but
that is mostly a problem with the demo design, not with the text widget.
I think that demos that show/create unexpected behaviour are not good demos.

One question remains, is it a good idea to have the peer text widget copy
-yscrollcommand and -xscrollcommand.   Probably not.

I don't quite understand how you expect something straightforward to happen as there are dozens of way to design a ui with a peered text widget, and the design and function will dictate how the scrolling should work.  In this case, the split window ui design could have been done better.

What is "straightforward" when you add a peer vertically above?
What is "straightforward" when you add a peer horizontally left?
What is "straightforward" when you add a peer horizontally right?

The peered text widget has no knowledge of the scrollbar, it cannot modify the scrollbar to do something different.

- The 'split window' button should not be instanced with a -create, as this button is not set up to work in a peer.
- The 'split window' ui design should add a second scrollbar.

marc_culler (claiming to be Marc Culler) added on 2017-10-31 02:59:33:
The scroll bar is bound to the left pane but it is adjacent to the right pane
and when you scroll the right pane with the scrollwheel the scrollbar reacts.
This may be a non-issue from a certain point of view, but I don't think that
behavior would be regarded as normal by most users.  Also, the issue is not
really whether weird behavior can be worked around with some effort, but whether
doing things in the straightforward way produces something that works as
expected.

bll added on 2017-10-30 22:05:39:
#3: 

When the cursor is over a combobox or over a list box, you may well want the scroll wheel to execute combobox or listbox bindings and not text widget bindings.

It could be resolved by automatically re-ordering the bindtags for certain widgets such as buttons.  (My opinion, I don't this is a great solution).

The scrollbar is bound to the left pane, and not to the right, so that is a non-issue.  The demo could be improved such that the scrollbar is bound to both panes or an additional scrollbar could be added to the demo.