Bambookit Home    Bambookit GUI Tutorial

Back    Next   

II. GUI Basics

Chapter 6. Widgets - Using Widgets to Create Interfaces


Listbox Widget. Listbox widget contains Item widgets.

XML Element Name


Examples - Listbox Size

Fixed size listbox. If the height of the listbox is set then the listbox does NOT dynamically adjust its height as more items are added.
<Listbox setLocation="10,10" setSize="80,100">
<Item setLabel="fixed size 1"/>
<Item setLabel="fixed size 2"/>
<Item setLabel="fixed size 3"/>

Variable size listbox. If the height is NOT set then the listbox adjusts itself internally, so instead of using setSize we only use setWidth and left the height to be defined by the addition of items.
<Listbox setLocation="100,10" setWidth="80">
<Item setLabel="variable size 1"/>
<Item setLabel="variable size 2"/>
<Item setLabel="variable size 3"/>

Examples - Item Size

Items can be added to the listbox.
Widget can be added to the listbox.
It should be noted that items are needed when creating a tree view. Only items are adapted to have the 'plus' and 'minus' gifs.
Items (or widgets) can have heights set, the widgets are automatically stretched to fit the to the client width of the listbox.

<Listbox setLocation="10,10" setWidth="80">
<Item setHeight="16" setLabel="height 16"/>
<Item setHeight="30" setLabel="height 30"/>
<Button setHeight="24" setLabel="height 24"/>
<Checkbox setHeight="32" setLabel="height 32"/>
<Listbox setLocation="100,10" setWidth="80">
<Item setLabel="gradient" setGradient="D9D9D9,FFFFFF,true,2"/>
<Item setLabel="background" setBackground="EFE9F3"/>
<Item setLabel="border" setBorder="squareraised"/>
<Item setLabel="fontstyle" setFontStyle="bolditalic"/>
<Item setLabel="image" addImage="images/linux.gif,16,6"/>

Examples - Listbox Column

All listboxes have a resizable bar and a sortable header.
1. The order for setting the visiblty of the header and the resize bar is important.
2. The Header and the Resize buttons attributes are settable (the colors, fonts, borders etc...).
3. The Resize button (not a crease mark) also acts like a doorstop, in other it enforces a minimum size.

<Listbox setLocation="10,10" setWidth="80" setShowResize="true" setShowHeader="true" setBorder="flat">
<Header setLabel="sort"/>
<Item setLabel="ccc"/>
<Item setLabel="aaa"/>
<Item setLabel="abc"/>
<Item setLabel="ddd"/>

Listbox properties

Basic set of methods that applies to all widgets and is applicable to Listbox/Item is described in the Chapter 9 for widgets styles, and Chapter 10 for widgets attributes. For event handling methods please refer to Chapter 12.

Listbox View, Scrollbars and Drag and Drop

Listbox view (adding scrollbars)
Drag and Drop Listbox (enabling drag and drop on various items)
Listbox Popups (similar to menus)

Back    Next