A ListView control lets you display items and icons in a variety of arrangements. You can display large or small icons in free-form lists. Using PowerScript functions such as AddColumn, AddLargePicture, SetItem, SetColumn, and so on, you can add columns, pictures, and items to the ListView and modify column properties.
Smartphone platforms PocketBuilder application users can use the arrow keys on the Smartphone to navigate the items in a ListView control, but you must program a menu item or soft key to move the focus from the ListView to another control in the same main window.
For information about ListView functions, see the online Help.
Figure 11-7: List view with small icons
The ListView control’s Properties view has two tab pages for adding pictures: Large Picture (default size 32 by 32 pixels) and Small Picture (16 by 16 pixels). Each picture you enter gets an index number that you can associate with an item in the Items page.
You can choose from a group of stock images provided by PocketBuilder or use BMP, GIF, ICO, JPEG, or PNG files for the images that you add to a ListView. You cannot add a PNG file to a picture control in the PocketBuilder UI, only in script. (PNG files are not supported on the desktop, only on Pocket PC devices and emulators.)
To add ListView items:
Select the ListView control to display its properties in the Properties view and then select the Items tab.
Enter the name of the ListView item and the picture index you want to associate with it.
The picture index corresponds to the images you select on the Large Picture, Small Picture, and State property pages.
On the Items tab page, you work with rows in the same way that you do for a ListBox control. For more information on working with rows on the Items tab page, see Table 11-3.
Set properties for the item on the Large Picture, Small Picture, and/or State tab pages as you did on the Items tab page.
On these pages, you can also browse for a picture. To do so, click the browse button or press F2.
Repeat until all the items are added to the ListView.
You can display a ListView in four styles:
Large icon (default)
Small icon
List
Report
To select a ListView style:
Select the ListView control to display its properties in the Properties view and then select the General tab.
Select the type of view you want from the View drop-down list.
You can modify other properties of the ListView control on the tab pages of the control’s Properties view.
To specify other ListView properties:
Select the ListView control to display its properties in the Properties view.
Choose the tab appropriate to the property you want to specify and change the properties as needed.
Choose this tab |
To specify |
---|---|
General |
The border style |
Whether the user can delete items |
|
Large Picture |
The images for ListView items in large icon view |
Small Picture |
The images for ListView items in small icon, list, and report views |
State |
The state images for ListView items |
Items |
The names and associated picture index for ListView items |
Font |
The font size, family, and color for ListView items |
Other |
The size and position of the ListView |
For more information about other properties, right-click in any tab page in the Properties view and select Help from the pop-up menu or see Objects and Controls. Because of target platform differences, some of the properties listed for PowerBuilder objects and controls do not apply to PocketBuilder objects and controls.
For more information on the ListView control, see the chapter on using lists and tree views in the Resource Guide.