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

Change width of ttk::scrollbar

197 views
Skip to first unread message

Harald Oehlmann

unread,
Apr 29, 2019, 11:58:15 AM4/29/19
to
Dear TCL'ers,

is there a way to change the width of a ttk::scrollbar ?

Thanks for any help,
Harald

Harald Oehlmann

unread,
Apr 29, 2019, 12:16:55 PM4/29/19
to
Well, configure the arrow size:

ttk::style configure My.Vertical.TScrollbar -arrowsize 100
pack [ttk::scrollbar .s -style My.Vertical.TScrollbar -orient vertical
-command ".t yview"] -fill y -expand true -side right
pack [text .t -yscrollcommand ".s set"] -side left -fill both -expand true
.t insert 1.0 [string repeat 1\n 100]

Thank you and sorry,
Harald

Harald Oehlmann

unread,
Apr 29, 2019, 3:31:06 PM4/29/19
to
Am 29.04.2019 um 18:16 schrieb Harald Oehlmann:
> Am 29.04.2019 um 17:58 schrieb Harald Oehlmann:
>> Dear TCL'ers,
>>
>> is there a way to change the width of a ttk::scrollbar ?
>>
>> Thanks for any help,
>> Harald
>>
>
> Well, configure the arrow size:
>
> ttk::style configure My.Vertical.TScrollbar -arrowsize 100
> pack [ttk::scrollbar .s -style My.Vertical.TScrollbar -orient verticaltheme.
> -command ".t yview"] -fill y -expand true -side right
> pack [text .t -yscrollcommand ".s set"] -side left -fill both -expand true
> .t insert 1.0 [string repeat 1\n 100]

The upper solution works for the internally drawn themes (clam) but not
for the vista theme (on win 10).

A solution for the vista theme would be appreciated.

Thank you,
Harald

Rich

unread,
Apr 29, 2019, 3:53:45 PM4/29/19
to
The vista theme on win 10 might be using native widgets.

It is possible that the native widgets can not have their sizes
adjusted.

Therefore, ttk:: might be limited, because the underlying native widget
library simply may not provide this capability.

Harald Oehlmann

unread,
Apr 29, 2019, 4:27:43 PM4/29/19
to
Rich,
thank you for the explanation which is certainly correct.

Nevertheless, I have observed Wizards using the ttk_vsapi commands to
modify native vista widgets.
And there is a -width and -height parameter to the low-level command
"ttk::style element create name vsapi className partId ?stateMap?
?options?". Maybe, someone has a solution...

Thank you anyway,
Harald

Christian Gollwitzer

unread,
Apr 29, 2019, 5:01:13 PM4/29/19
to
Am 29.04.19 um 21:31 schrieb Harald Oehlmann:
> Am 29.04.2019 um 18:16 schrieb Harald Oehlmann:
>> Am 29.04.2019 um 17:58 schrieb Harald Oehlmann:
>>> Dear TCL'ers,
>>>
>>> is there a way to change the width of a ttk::scrollbar ?

>> ttk::style configure My.Vertical.TScrollbar -arrowsize 100
>> pack [ttk::scrollbar .s -style My.Vertical.TScrollbar -orient verticaltheme.
>> -command ".t yview"] -fill y -expand true -side right
>> pack [text .t -yscrollcommand ".s set"] -side left -fill both -expand true
>> .t insert 1.0 [string repeat 1\n 100]
>
> The upper solution works for the internally drawn themes (clam) but not
> for the vista theme (on win 10).
>
> A solution for the vista theme would be appreciated.

I might be mistaken, but I remember that the scrollbar can be forcibly
adjusted by the geometry manager. Have you tried to grid it as -sticky
nsew and then configure the -minsize of the column or row? At least on
OSX this seems to result in a scaled scrollbar, albeit it looks quite odd.

Christian


Harald Oehlmann

unread,
Apr 30, 2019, 12:56:56 AM4/30/19
to
Christian,

thank you for the suggestion.

I have tried this in another way:

pack [ttk::scrollbar .s] -fill both -expand true

The scrollbar takes the vertical size but not the horizontal.

I suppose, this test is equivalent to the grid test, isn't it ?

Thank you,
Harald

Christian Gollwitzer

unread,
Apr 30, 2019, 3:56:38 AM4/30/19
to
Am 30.04.19 um 06:56 schrieb Harald Oehlmann:
> Am 29.04.2019 um 23:01 schrieb Christian Gollwitzer:
>> I might be mistaken, but I remember that the scrollbar can be forcibly
>> adjusted by the geometry manager. Have you tried to grid it as -sticky
>> nsew and then configure the -minsize of the column  or row? At least on
>> OSX this seems to result in a scaled scrollbar, albeit it looks quite odd.
>>
>
> thank you for the suggestion.
>
> I have tried this in another way:
>
> pack [ttk::scrollbar .s] -fill both -expand true
>
> The scrollbar takes the vertical size but not the horizontal.
>
> I suppose, this test is equivalent to the grid test, isn't it ?

Yes it should. If I try this on OSX, then the shading of the scrollbar
expands, but the moveable slider in it does not. So maybe for native
widgets there is no way to expand it?

May I ask why you want to modify the appearance of the native widgets?

Christian

Harald Oehlmann

unread,
Apr 30, 2019, 11:39:37 AM4/30/19
to
Am 30.04.2019 um 09:56 schrieb Christian Gollwitzer:
> May I ask why you want to modify the appearance of the native widgets?

It is for touch-screen operation to make it easier to push the buttons.

All clickable GUI-elements (like buttons) may be changed in size and I
also wanted to resize the scrollbar, which is naturally composed of 5
buttons.

Thank you,
Harald

Harald Oehlmann

unread,
Apr 30, 2019, 12:15:06 PM4/30/19
to
Am 30.04.2019 um 09:56 schrieb Christian Gollwitzer:
> Am 30.04.19 um 06:56 schrieb Harald Oehlmann:
>> Am 29.04.2019 um 23:01 schrieb Christian Gollwitzer:
>>> I might be mistaken, but I remember that the scrollbar can be forcibly
>>> adjusted by the geometry manager. Have you tried to grid it as -sticky
>>> nsew and then configure the -minsize of the column  or row? At least on
>>> OSX this seems to result in a scaled scrollbar, albeit it looks quite
>>> odd.
>>>
>>
>> thank you for the suggestion.
>>
>> I have tried this in another way:
>>
>> pack [ttk::scrollbar .s] -fill both -expand true
>>
>> The scrollbar takes the vertical size but not the horizontal.
>>
>> I suppose, this test is equivalent to the grid test, isn't it ?
>
> Yes it should. If I try this on OSX, then the shading of the scrollbar
> expands, but the moveable slider in it does not.
Maybe file a bug report, if it gets corrupted...

Harald Oehlmann

unread,
Apr 30, 2019, 12:33:17 PM4/30/19
to
The scrollbar creation code in vistaTheme.tcl is:

namespace eval ttk::theme::vista {
ttk::style element create Vertical.Scrollbar.uparrow vsapi \
SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \
-syssize {SM_CXVSCROLL SM_CYVSCROLL}
ttk::style element create Vertical.Scrollbar.downarrow vsapi \
SCROLLBAR 1 {disabled 8 pressed 7 active 6 hover 18 {} 5} \
-syssize {SM_CXVSCROLL SM_CYVSCROLL}
ttk::style element create Vertical.Scrollbar.trough vsapi \
SCROLLBAR 7 {disabled 4 pressed 3 active 2 hover 5 {} 1}
ttk::style element create Vertical.Scrollbar.thumb vsapi \
SCROLLBAR 3 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
-syssize {SM_CXVSCROLL SM_CYVSCROLL}
ttk::style element create Vertical.Scrollbar.grip vsapi \
SCROLLBAR 9 {disabled 4 pressed 3 active 2 hover 5 {} 1} \
-syssize {SM_CXVSCROLL SM_CYVSCROLL}
}

Thus try:
namespace eval ttk::theme::vista {
ttk::style element create Vertical.Scrollbar.uparrow vsapi \
SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \
-syssize {SM_CXBORDER SM_CYBORDER}
}

pack [ttk::scrollbar .s] -expand true -fill both

No influence on the scrollbar arrow.

Anyway, may try other things soon.

THank you all and happy 1st May,
Harald
0 new messages