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.
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.