1ttk::scrollbar(n)              Tk Themed Widget              ttk::scrollbar(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       ttk::scrollbar - Control the viewport of a scrollable widget
9

SYNOPSIS

11       ttk::scrollbar pathName ?options...?
12______________________________________________________________________________
13

DESCRIPTION

15       ttk::scrollbar  widgets  are  typically  linked to an associated window
16       that displays a document of some sort, such as a file being edited or a
17       drawing.   A  scrollbar  displays  a thumb in the middle portion of the
18       scrollbar, whose position and size provides information about the  por‐
19       tion  of  the document visible in the associated window.  The thumb may
20       be dragged by the user to control the visible region.  Depending on the
21       theme, two or more arrow buttons may also be present; these are used to
22       scroll the visible region in discrete units.
23

STANDARD OPTIONS

25       -class                -cursor              -style
26       -takefocus
27
28       See the ttk_widget manual entry for details on the standard options.
29

WIDGET-SPECIFIC OPTIONS

31       Command-Line Name:-command
32       Database Name:  command
33       Database Class: Command
34
35              A Tcl script prefix to evaluate to change the view in the widget
36              associated   with   the  scrollbar.   Additional  arguments  are
37              appended to the value of this option, as described in  SCROLLING
38              COMMANDS  below,  whenever  the  user  requests a view change by
39              manipulating the scrollbar.
40
41              This option typically consists of a two-element list, containing
42              the  name  of  a scrollable widget followed by either xview (for
43              horizontal scrollbars) or yview (for vertical scrollbars).
44
45       Command-Line Name:-orient
46       Database Name:  orient
47       Database Class: Orient
48
49              One of horizontal or vertical.  Specifies the orientation of the
50              scrollbar.
51

WIDGET COMMAND

53       pathName cget option
54              Returns the current value of the specified option; see ttk::wid‐
55              get(n).
56
57       pathName configure ?option? ?value option value ...?
58              Modify or query widget options; see ttk::widget(n).
59
60       pathName get
61              Returns the scrollbar settings in the form of a list whose  ele‐
62              ments are the arguments to the most recent set widget command.
63
64       pathName identify x y
65              Returns the name of the element at position x, y.  See ttk::wid‐
66              get(n).
67
68       pathName instate statespec ?script?
69              Test the widget state; see ttk::widget(n).
70
71       pathName set first last
72              This command is normally invoked by the  scrollbar's  associated
73              widget  from  an  -xscrollcommand  or  -yscrollcommand callback.
74              Specifies the visible range to be displayed.  first and last are
75              real fractions between 0 and 1.
76
77       pathName state ?stateSpec?
78              Modify or query the widget state; see ttk::widget(n).
79

INTERNAL COMMANDS

81       The  following  widget  commands  are used internally by the TScrollbar
82       widget class bindings.
83
84       pathName delta deltaX deltaY
85              Returns a real number indicating the fractional  change  in  the
86              scrollbar  setting  that  corresponds to a given change in thumb
87              position.  For example, if  the  scrollbar  is  horizontal,  the
88              result  indicates  how much the scrollbar setting must change to
89              move the thumb deltaX pixels to the right (deltaY is ignored  in
90              this  case).  If the scrollbar is vertical, the result indicates
91              how much the scrollbar setting must change  to  move  the  thumb
92              deltaY pixels down.  The arguments and the result may be zero or
93              negative.
94
95       pathName fraction x y
96              Returns a real number between 0 and 1 indicating where the point
97              given by x and y lies in the trough area of the scrollbar, where
98              0.0 corresponds to the top or left of the trough and 1.0  corre‐
99              sponds  to  the  bottom or right.  X and y are pixel coordinates
100              relative to the scrollbar widget.  If x and y refer to  a  point
101              outside the trough, the closest point in the trough is used.
102

SCROLLING COMMANDS

104       When the user interacts with the scrollbar, for example by dragging the
105       thumb, the scrollbar notifies the associated widget that it must change
106       its  view.   The  scrollbar  makes the notification by evaluating a Tcl
107       command generated from the scrollbar's -command  option.   The  command
108       may  take any of the following forms.  In each case, prefix is the con‐
109       tents of the -command option, which usually has a form like .t yview
110
111       prefix moveto fraction
112              Fraction is a real number between 0 and 1.   The  widget  should
113              adjust  its  view so that the point given by fraction appears at
114              the beginning of the widget.  If fraction is 0 it refers to  the
115              beginning  of  the document.  1.0 refers to the end of the docu‐
116              ment, 0.333 refers to a point one-third of the way  through  the
117              document, and so on.
118
119       prefix scroll number units
120              The  widget  should  adjust its view by number units.  The units
121              are defined in whatever way makes sense for the widget, such  as
122              characters or lines in a text widget.  Number is either 1, which
123              means one unit should scroll off the top or left of the  window,
124              or -1, which means that one unit should scroll off the bottom or
125              right of the window.
126
127       prefix scroll number pages
128              The widget should adjust its view by number pages.  It is up  to
129              the  widget  to  define  the meaning of a page;  typically it is
130              slightly less than what fits in the window, so that there  is  a
131              slight  overlap between the old and new views.  Number is either
132              1, which means the next page should become visible, or -1, which
133              means that the previous page should become visible.
134

WIDGET STATES

136       The  scrollbar  automatically  sets  the  disabled state bit.  when the
137       entire range is visible (range is 0.0 to 1.0), and clears it otherwise.
138       It also sets the active and pressed state flags of individual elements,
139       based on the position and state of the mouse pointer.
140

EXAMPLE

142              set f [frame .f]
143              ttk::scrollbar $f.hsb -orient horizontal -command [list $f.t xview]
144              ttk::scrollbar $f.vsb -orient vertical -command [list $f.t yview]
145              text $f.t -xscrollcommand [list $f.hsb set] -yscrollcommand [list $f.vsb set]
146              grid $f.t -row 0 -column 0 -sticky nsew
147              grid $f.vsb -row 0 -column 1 -sticky nsew
148              grid $f.hsb -row 1 -column 0 -sticky nsew
149              grid columnconfigure $f 0 -weight 1
150              grid rowconfigure $f 0 -weight 1
151              pack $f
152

STYLING OPTIONS

154       The class name for a ttk::scrollbar is TScrollbar.
155
156       Dynamic states: active, disabled.
157
158       TScrollbar  (or  more  specifically  Vertical.TScrollbar  and  Horizon‐
159       tal.TScrollbar)  styling  options that are configurable with ttk::style
160       are:
161
162       -arrowcolor color
163       -arrowsize amount
164       -background color
165       -bordercolor color
166       -darkcolor color (color of the dark part of the 3D relief)
167       -foreground color
168       -gripcount count (number of lines on the thumb)
169       -lightcolor color (color of the light part of the 3D relief)
170       -troughcolor color
171
172       Some options are only available for specific themes.
173
174       See the ttk::style manual page for information on how to configure  ttk
175       styles.
176

SEE ALSO

178       ttk::widget(n), scrollbar(n)
179

KEYWORDS

181       scrollbar, widget
182
183
184
185Tk                                    8.5                    ttk::scrollbar(n)
Impressum