Itcl Two-way Scrolled Area Widget

The scrolled widget provides a container for another widget which can be scrolled in both the x and y directions. The widget includes the horizontal and vertical scrollbars and ensures that the scrollbars are correctly alligned with the side of the widget to be scrolled.

Synopsis

scrolled pathName ?options?
create a new scrolled-area widget named pathName.
pathName option ?args...?
manipulate the scrolled-area widget named pathName.

Options

Name: background
Class: Background
Command-Line Switch: -background
Default: #ccc
Specifies the background colour of the widget.

Name: relief
Class: Relief
Command-Line Switch: -relief
Default: flat
Specifies the appearance of the widget's three-dimensional border. This option can take any of the values accepted by Tk_GetRelief(3).

Name: borderWidth
Class: BorderWidth
Command-Line Switch: -borderwidth
Default: 0
Specifies the width of the widget's three-dimensional border in screen units.

Name: scrollBackground
Class: Background
Command-Line Switch: -scrollbackground
Default: #ccc
Specifies the background colour of the widget's scrollbars.

Name: scrollForeground
Class: Foreground
Command-Line Switch: -scrollforeground
Default: #ccc
Specifies the background colour of the widget's scrollbars.

Name: scrollRelief
Class: Relief
Command-Line Switch: -scrollrelief
Default: flat
Specifies the appearance of the three-dimensional border around the scrollbars of the widget. This option can take any of the values accepted by Tk_GetRelief(3).

Name: scrollBorderWidth
Class: BorderWidth
Command-Line Switch: -scrollborderwidth
Default: 0
Specifies the width of the three-dimensional border of the widget's scrollbars in screen units.

Name: manageKeyboard
Class: ManageKeyboard
Command-Line Switch: -managekbd
Default: 1
If set to 1 (the default), the widget will handle keyboard traversal between its scrollbars. If the widget to be scrolled can be scrolled via the keyboard, this option should be set to 0 and the

Name: padX
Class: Pad
Command-Line Switch: -padx
Default: 2
Specifies the amount of horizontal padding (in screen units) to add around the scrollbars when packing them into the widget. Note that to obtain the correct allignment between the scrollbars and the widget to be scrolled, the widget to be scrolled must be packed into the scrolled widget with the same amount of horizontal padding.

Name: padY
Class: Pad
Command-Line Switch: -padx
Default: 2
Specifies the amount of horizontal padding (in screen units) to add around the scrollbars when packing them into the widget. Note that to obtain the correct allignment between the scrollbars and the widget to be scrolled, the widget to be scrolled must be packed into the scrolled widget with the same amount of vertical padding.

Name: N/A
Class: N/A
Command-Line Switch: -xcommand
Default: 0
The command to be executed whenever the user moves the slider or clicks on the arrows of the horizontal scrollbar. This has the same format and is invoked in the same way as the command option of Tk's scrollbar widget.

Name: N/A
Class: N/A
Command-Line Switch: -ycommand
Default: 0
The command to be executed whenever the user moves the slider or clicks on the arrows of the vertical scrollbar. This has the same format and is invoked in the same way as the command option of Tk's scrollbar widget.

Widget Command

pathName configure ?option value...?
configure the widget.

pathName xset total width first last

pathName yset total width first last

pathName xget
Returns a Tcl list containing four decimal values, which are the current totalUnits, windowUnits, firstUnit, and lastUnit values for the horizontal scrollbar. These are the values from the most recent xset widget command.

pathName yget
Returns a Tcl list containing four decimal values, which are the current totalUnits, windowUnits, firstUnit, and lastUnit values for the vertical scrollbar. These are the values from the most recent yset widget command.

pathName manage widget ?widget...?
pathName unmanagemanage widget ?widget...? These widget commands have the same effect as those of the tabgroup widget.

Usage

The scrolled widget is used instead of a tabgroup and two scrollbars. In fact that's pretty much what it is, except that it has a more Motif-like visual appearance. The widget to be scrolled should be packed into the scrolled widget with the same -padx and -pady options as passed to the scrolled widget itself. For instance:

scrolled .s -padx 2 -pady 2 -xcommand {.l xview} -ycommand {.l yview} listbox .l -xscrollcommand {.s xset} -yscrollcommand {.s yset} pack .l -in .s -fill both -padx 2 -pady 2 -expand yes pack .s -fill both -expand yes