Tk Source Code

View Ticket
Login
Ticket UUID: 51b4b18394571bc80a12c2a1e8eceed84e1b8e32
Title: mac os x: combobox.tcl has old scrollbar for its listbox
Type: Bug Version: 8.6.8
Submitter: bll Created on: 2018-09-04 17:41:40
Subsystem: 88. Themed Tk Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2019-05-08 08:50:35
Resolution: Fixed Closed By: fvogel
    Closed on: 2019-05-08 08:50:35
Description:
In ttk/combobox.tcl, the following code is old.  There is
a native ttk scrollbar on aqua.

namespace eval ::ttk::combobox {
    # @@@ Until we have a proper native scrollbar on Aqua, use
    # @@@ the regular Tk one.  Use ttk::scrollbar on other platforms.
    variable scrollbar ttk::scrollbar
    if {[tk windowingsystem] eq "aqua"} {
        set scrollbar ::scrollbar
    }
}
User Comments: fvogel added on 2019-05-08 08:50:35:
Merged into core-8-6-branch and trunk. Thanks for your tests!

bll added on 2019-05-02 19:46:06:
Dynamic theme switching does work, unlike the older scrollbar implementation.

Both the scrollbars on the text widget and the scrollbar in the combobox 
are switched.

bll added on 2019-05-02 19:04:15:
To properly answer your question, no, did not try dynamic theme switching.

bll added on 2019-05-02 19:02:33:
That's not possible on the mac.
Once a scrollbar is non-aqua styled, it cannot be switched back.

In general, I would not try to fully support switching themes dynamically
without exiting the program and restarting.  Too problematic.

fvogel added on 2019-05-02 06:16:17:
Can you confirm how far you tested? Did you try (on the mac) to switch themes, and see the scrollbar of the listbox of the combobox switch appearance?

bll added on 2019-05-02 00:25:12:
Looks good, no issues.

fvogel added on 2019-05-01 18:33:27:

Indeed, Marc has implemented a ttk::scrollbar for macOS in [c2fa11ecb7af45b5].

I have implemented a fix for the present ticket, see [b7fe577c]. Could you please test it?


bll added on 2019-05-01 17:00:07:
This is outdated now that Marc Culler has implemented a ttk::scrollbar (for 8.6.10).

ttk/combobox.tcl should be changed to remove the 'scrollbar' variable 
entirely and simply always use ttk::scrollbar.

bll added on 2018-09-06 02:14:58:
I am not advocating changing the aqua scrollbar at all.

The test in the code snippet above should simply be set to

if theme == aqua, not testing the windowing system.

Other themes work fine on Mac OS X.
It takes more changes than above to get the ttk::combobox's scrollbar
styled properly, but that's not covered by this ticket.

kevin_walzer added on 2018-09-06 01:50:00:
If non-native themes such as Clam and Alt support scrollbars styled with those themes, then I suppose it might make sense to enable that on macOS. I don't know if that's a little bit of work (modifying the code snippet above) or a lot (implementing scrollbars in every theme). Perhaps you can offer some advice here. However, the purpose of the widgets with the platform-specific theme (Aqua) is to have a native UI. Native scrollbars on the Mac don't support the fine-grained configuration you are seeking, and it makes no sense to try to enable that in the Aqua theme; it would make this theme less-native, which I oppose.

bll added on 2018-09-05 13:17:33:
> Under macOS, there has always been only one scrollbar, and it already adheres to > the platform's current theme (analogous to the ttk scrollbar on Windows). It has > never made sense to use anything but the standard scrollbar.

This is false.
Try styling the scrollbar as posted.

And it makes a huge amount of sense to use something besides the standard
scrollbar because the standard scrollbar is so broken.  Using a styled
scrollbar gets me the unix behavior, and the cursor and grab of the slider
work.

kevin_walzer added on 2018-09-05 12:13:07:
I'm not clear on the issue here. 

Under X11, all scrollbars are drawn by Tk, so theming them is part of the process. 

Under Win32, Tk's scrollbar uses a legacy API, and the themed scrollbar uses a modern API. Both are native, but different in appearance, so again, it's easy to test them.

Under macOS, there has always been only one scrollbar, and it already adheres to the platform's current theme (analogous to the ttk scrollbar on Windows). It has never made sense to use anything but the standard scrollbar.

So I come back to my original observation, and question: You are accurately describing the behavior; what is your point?

bll added on 2018-09-05 07:06:10:
As I understand it:

The aqua theme has a standard 'scrollbar'.  This uses the native 
engine and native theming.

With other themes either can be used:
  ttk::scrollbar
  standard scrollbar - this is just going to get an aqua themed scrollbar

You can try:
   package require Tk
   ttk::style theme use alt
   ttk::scrollbar .sbA -orient vertical  ; # this will be an aqua scrollbar
   pack .sbA -side left -fill y -expand 1
   ttk::scrollbar .sbB -orient vertical -style Vertical.TScrollbar
   pack .sbB -side left -fill y -expand 1
   ttk::scrollbar .sbC -orient vertical
   #ttk::style configure .sbC -style Vertical.TScrollbar ; # error
   # a aqua scrollbar cannot be ttk::style'd
   scrollbar .sbD
   pack .sbD -side left -fill y -expand 1
   ttk::combobox .cb -height 4 \
      -values {aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww} 
  pack .cb

The aqua theme doesn't seem to care if ttk::scrollbar is used -- 
it does its own thing with it.

fvogel added on 2018-09-05 06:47:13:
Not sure I understand this:
You meqn that on macOS with the Aqua windowing system the theme "aqua" exercises a native scrollbar? What other themes have this on macOS?

bll added on 2018-09-05 03:33:15:
Ok.
But it should be testing the theme, not the windowing system.
Other themes have ttk scrollbars.

kevin_walzer added on 2018-09-05 01:50:57:
This code is correct. We don't have a ttk scrollbar on the Mac, never have, and thus still default to the standard scrollbar.