Scrolled lists
Each of the container widgets can be created with scrolling capability, much like CwList. All resources and callbacks associated with a particular list can be applied to the scrolled version of that list. Scrolling is handled automatically. The scrollHorizontal resource specifies whether the widget should provide a horizontal scroll bar.
Tip:
The horizontal scroll bar will not be shown in the list widget unless it has been created as a scrolled list, even if the scrollHorizontal resource is set to true.
The scrollBarDisplayPolicy resource controls the automatic placement of the scroll bars. If the resource is set to XmASNEEDED, scroll bars are displayed if the list items exceed the list work region in one or both dimensions. If the resource is set to XmSTATIC, scroll bars are displayed regardless of the relationship between the size of the list items and the list work region.
In the following example, a scrolled EwIconList is created as a child of a form. Creating a scrolled list inserts a CwScrolledWindow parent between the list and the receiver of the creation message, in this case, the form. It is important to understand this distinction when attaching a scrolled list to a form or attaching other form children to the list.
| shell form iconList |
shell := CwTopLevelShell
createApplicationShell: 'shell'
argBlock: [:w | w title: 'Scrolling List Example'].
form := shell
createForm: 'form'
argBlock: nil.
form manageChild.
iconList := form
createScrolledIconList: 'scrolled list'
argBlock: [:w | w
items: self itemList;
scrollHorizontal: true].
iconList manageChild.
"Note: The icon list's parent is sent attachment messages."
iconList parent
setValuesBlock: [:w | w
topAttachment: XmATTACHFORM;
rightAttachment: XmATTACHFORM;
leftAttachment: XmATTACHFORM;
bottomAttachment: XmATTACHFORM].
shell realizeWidget.
Tip:
When a scrolled list is created, the creation message returns an instance of the list (the child of a CwScrolledWindow). However, because the CwScrolledWindow is itself the child of the form, form attachment messages must be sent to the list's parent (that is, to the CwScrolledWindow). Any other form children attaching to the scrolled list should be attached to the list's parent.
Last modified date: 01/29/2015