1scrollbar(n)                    Tile Widget Set                   scrollbar(n)
2
3
4

NAME

6       ttk::scrollbar - Control the viewport of a scrollable widget
7

SYNOPSIS

9       ttk::scrollbar       pathName       ?options...?        -class    -cur‐
10       sor   -style    -takefocus
11

WIDGET-SPECIFIC OPTIONS

13       [-command command] A Tcl script prefix to evaluate to change  the  view
14       in  the widget associated with the scrollbar.  Additional arguments are
15       appended to the value of this option, as described  in  SCROLLING  COM‐
16       MANDS  below,  whenever the user requests a view change by manipulating
17       the scrollbar.
18       This option typically consists of a two-element  list,  containing  the
19       name  of  a  scrollable widget followed by either xview (for horizontal
20       scrollbars) or yview (for vertical scrollbars).   [-orient orient]  One
21       of horizontal or vertical.  Specifies the orientation of the scrollbar.
22
23

DESCRIPTION

25       Scrollbar  widgets  are  typically  linked to an associated window that
26       displays a document of some sort, such as a  file  being  edited  or  a
27       drawing.   A  scrollbar  displays  a thumb in the middle portion of the
28       scrollbar, whose position and size provides information about the  por‐
29       tion  of  the document visible in the associated window.  The thumb may
30       be dragged by the user to control the visible region.  Depending on the
31       theme, two or more arrow buttons may also be present; these are used to
32       scroll the visible region in discrete units.
33

WIDGET COMMAND

35       pathName cget option
36              Returns the current value of  the  specified  option;  see  wid‐
37              get(n).
38
39       pathName configure ?option? ?value option value ...?
40              Modify or query widget options; see widget(n).
41
42       pathName get
43              Returns  the scrollbar settings in the form of a list whose ele‐
44              ments are the arguments to the most recent set widget command.
45
46       pathName instate statespec ?script?
47              Test the widget state; see widget(n).
48
49       pathName set first last
50              This command is normally invoked by the  scrollbar's  associated
51              widget  from  an  -xscrollcommand  or  -yscrollcommand callback.
52              Specifies the visible range to be displayed.  first and last are
53              real fractions between 0 and 1.
54
55       pathName state ?stateSpec?
56              Modify or query the widget state; see widget(n).
57

INTERNAL COMMANDS

59       The  following  widget  commands  are used internally by the TScrollbar
60       widget class bindings.
61
62       pathName delta deltaX deltaY
63              Returns a real number indicating the fractional  change  in  the
64              scrollbar  setting  that  corresponds to a given change in thumb
65              position.  For example, if  the  scrollbar  is  horizontal,  the
66              result  indicates  how much the scrollbar setting must change to
67              move the thumb deltaX pixels to the right (deltaY is ignored  in
68              this  case).  If the scrollbar is vertical, the result indicates
69              how much the scrollbar setting must change  to  move  the  thumb
70              deltaY pixels down.  The arguments and the result may be zero or
71              negative.
72
73       pathName fraction x y
74              Returns a real number between 0 and 1 indicating where the point
75              given by x and y lies in the trough area of the scrollbar, where
76              0.0 corresponds to the top or left of the trough and 1.0  corre‐
77              sponds  to  the  bottom or right.  X and y are pixel coordinates
78              relative to the scrollbar widget.  If x and y refer to  a  point
79              outside the trough, the closest point in the trough is used.
80
81       pathName identify x y
82              Returns  the  name of the element under the point given by x and
83              y, or an empty string if the point does not lie in  any  element
84              of the scrollbar.  X and y are pixel coordinates relative to the
85              scrollbar widget.
86

SCROLLING COMMANDS

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

WIDGET STATES

120       The scrollbar automatically sets the  disabled  state  bit.   when  the
121       entire range is visible (range is 0.0 to 1.0), and clears it otherwise.
122       It also sets the active and pressed state flags of individual elements,
123       based on the position and state of the mouse pointer.
124

EXAMPLE

126       set  f  [frame  .f]  ttk::scrollbar  $f.hsb -orient horizontal -command
127       [list $f.t xview] ttk::scrollbar $f.vsb -orient vertical -command [list
128       $f.t yview] text $f.t -xscrollcommand [list $f.hsb set] -yscrollcommand
129       [list $f.vsb set] grid $f.t -row 0 -column 0 -sticky nsew  grid  $f.vsb
130       -row 0 -column 1 -sticky nsew grid $f.hsb -row 1 -column 0 -sticky nsew
131       grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1
132

KEYWORDS

134       scrollbar, widget
135
136
137
138tile                                  0.5                         scrollbar(n)
Impressum