Bambookit Home    Bambookit GUI Tutorial

Back    Next   

II. GUI Basics

Chapter 6. Widgets - Using Widgets to Create Interfaces




View & Scrollbar

View Widget Listbox View. Adding Scrollbars to a Listbox

The View control is made up of the Vertical Scrollbar, the Horizontal Scrollbar and the Pan Widget. The Pan widget in this case would be the listbox.

XML Element Name

<View>
<Listbox>
<Item/>
<Item/>
<Item/>
</Listbox>
</View>

Example

To add scrollbars to the listbox we simply place it in a view control. The View width has been set to 102 pixels wide, the vertical scrollbar takes a width of 18 (by default), the border of the View (a square raised) is 2 pixels wide. Thus to flush the listbox hotizontally to the view Control we subtract 102 minus 4 pixels (square raised width) and minus 18 pixels (the Vertical Scrollbar width).

Note: most other controls, if they are focus traversable will also include a focus traversable border (one pixel thickness, to display the blue highlight whenever the widget gains focus).

<View setShape="10,10,102,100" setBorder="squareraised">
<Listbox>
<Item setLabel="item 1"/>
<Item setLabel="item 2"/>
<Item setLabel="item 3"/>
<Item setLabel="item 4"/>
<Item setLabel="item 5"/>
<Item setLabel="item 6"/>
<Item setLabel="item 7"/>
</Listbox>
</View>

In the example below the vertical scrollbar is displayed and the horizontal scrollbar is disabled. As soon as the horizontal scrollbar is needed it will be enabled

The default width of the Listbox is set to 80 pixels wide.



Back    Next