ttk::scrollbar(n) | Tk Themed Widget | ttk::scrollbar(n) |
ttk::scrollbar - Control the viewport of a scrollable widget
ttk::scrollbar pathName ?options...?
ttk::scrollbar widgets are typically linked to an associated window that displays a document of some sort, such as a file being edited or a drawing. A scrollbar displays a thumb in the middle portion of the scrollbar, whose position and size provides information about the portion of the document visible in the associated window. The thumb may be dragged by the user to control the visible region. Depending on the theme, two or more arrow buttons may also be present; these are used to scroll the visible region in discrete units.
-class -cursor -style -takefocus
See the ttk_widget manual entry for details on the standard options.
[-command command] A Tcl script prefix to evaluate to change the view in the widget associated with the scrollbar. Additional arguments are appended to the value of this option, as described in SCROLLING COMMANDS below, whenever the user requests a view change by manipulating the scrollbar.
This option typically consists of a two-element list, containing the name of a scrollable widget followed by either xview (for horizontal scrollbars) or yview (for vertical scrollbars).
The following widget commands are used internally by the TScrollbar widget class bindings.
When the user interacts with the scrollbar, for example by dragging the thumb, the scrollbar notifies the associated widget that it must change its view. The scrollbar makes the notification by evaluating a Tcl command generated from the scrollbar's -command option. The command may take any of the following forms. In each case, prefix is the contents of the -command option, which usually has a form like .t yview
The scrollbar automatically sets the disabled state bit. when the entire range is visible (range is 0.0 to 1.0), and clears it otherwise. It also sets the active and pressed state flags of individual elements, based on the position and state of the mouse pointer.
set f [frame .f] ttk::scrollbar $f.hsb -orient horizontal -command [list $f.t xview] ttk::scrollbar $f.vsb -orient vertical -command [list $f.t yview] text $f.t -xscrollcommand [list $f.hsb set] -yscrollcommand [list $f.vsb set] grid $f.t -row 0 -column 0 -sticky nsew grid $f.vsb -row 0 -column 1 -sticky nsew grid $f.hsb -row 1 -column 0 -sticky nsew grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1
ttk::widget(n), scrollbar(n)
scrollbar, widget
8.5 | Tk |